functions, list, default parameters

Steven D'Aprano steve at
Fri Oct 22 09:36:21 CEST 2010

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, and there is an easy work-
around for anyone who wants default arguments to be created on function 
invocation rather than function definition.


More information about the Python-list mailing list