Path: csiph.com!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!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:30:02 +1300 Lines: 20 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net sQ2CE6MmZp2fmmO/4Z9wZg8g+mewW17m6RpJDYISthvgOH7vv0 Cancel-Lock: sha1:nnHxqdKDm9wvm6aurwHsRZ3XnJg= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:99246 BartC wrote: > What's bothering me is: > > ... > > * The insistence (I think largely from Steven) that the way this feature > works is good rather than bad Here's one reason to prefer the way it currently works: It's rare to want a mutable default value. The vast majority of default values are simple things such as None, 0 or "". Evaluating the default expression on every call in those cases would just be useless overhead. So Python optimises for the most common case. When you need a mutable default, there is a straightforward way to get it. -- Greg