Please explain this strange Python behaviour

Tim Chase python.list at tim.thechases.com
Thu Apr 30 08:27:58 EDT 2009


Duncan Booth wrote:
> Tim Chase <python.list at tim.thechases.com> wrote:
> 
>> There _are_ cases where it's a useful behavior, but they're rare, 
>> so I don't advocate getting rid of it.  But it is enough of a 
>> beginner gotcha that it really should be in the Python FAQ at 
>> www.python.org/doc/faq/general/
>>
> 
> That's an excellent idea!
> 
> So excellent in fact that it already is:
> http://www.python.org/doc/faq/general/#why-are-default-values-shared-between-objects

Dang...I thought I did a search on that page for "default" and 
must have totally missed it (either for searching on the wrong 
page, misspelling "default", or having my eyes distracted by the 
neighboring FAQ about "goto" which I certainly remember seeing in 
my hunt).  Guess that's what I get for responding before breakfast.

Thanks,

-tkc






More information about the Python-list mailing list