functions, list, default parameters

Chris Rebert clp2 at rebertia.com
Tue Nov 2 03:40:17 EDT 2010


On Fri, Oct 22, 2010 at 12:36 AM, Steven D'Aprano
<steve at remove-this-cybersource.com.au> wrote:
> On Thu, 21 Oct 2010 19:53:53 -0700, John Nagle wrote:
>>> This is a common newbie stumbling-block: Don't use lists (or anything
>>> mutable) as default argument values
>>
>>      That really should be an error.
>
> No it shouldn't. Punishing everybody for a newbie mistake that nobody
> makes twice would be the error.
>
> Default mutable arguments have their place

But it's a rather obscure one where it is almost never strictly
necessary to venture.

Cheers,
Chris



More information about the Python-list mailing list