Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: What is a function parameter =[] for? Date: Mon, 23 Nov 2015 12:43:52 +1300 Lines: 15 Message-ID: References: <564dbe6b$0$1610$c3e8da3$5496439d@news.astraweb.com> <564df258$0$1604$c3e8da3$5496439d@news.astraweb.com> <564e71f6$0$1619$c3e8da3$5496439d@news.astraweb.com> <565139f0$0$1598$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 40U1u/1432qh7EIbQIIBQAQJH9wlJoaNg7616YjdqaPDM/LQny Cancel-Lock: sha1:4NMOjhohziCR2zeoMGZbLAcrGpg= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: <565139f0$0$1598$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:99247 Steven D'Aprano wrote: > Memoisation isn't "esoteric", it is a simple, basic and widely-used > technique used to improve performance of otherwise expensive functions. That may be true, but I don't think it's a good example of a use for a shared, mutable default value, because it's arguably an *abuse* of the default value mechanism. Whenever I want to cache function values, I use a module level variable to hold the cache. It's clearer, and it doesn't clutter the function signature with something that isn't logically a part of it at all. -- Greg