Somthing strange with list as default argument

Duncan Booth duncan.booth at invalid.invalid
Wed Sep 22 04:33:56 EDT 2004


Julien Sagnard wrote:

> When passing a list as default argument for a function, only one list is 
> created for all calls.
> exemple:

<example snipped>

> 
> I'm not found any reference of this. Is it a bug ?
> I'm working on Windows 2000 with python 2.3.4
> 

You didn't search hard enough (although its not that easy a thing to search 
for if you don't know the answer).

Please read the FAQ:

http://www.python.org/doc/faq/general.html#why-are-default-values-shared-between-objects




More information about the Python-list mailing list