function with list argument defaulting to [] - what's going on here???

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Sun Apr 15 00:11:02 EDT 2007


On Sun, 15 Apr 2007 05:29:01 +0200, BJörn Lindqvist wrote:

>> This comes up so often that I wonder whether Python should issue a warning
>> when it sees [] or {} as a default argument.
>>
>>
>> What do people think? A misuse or good use of warnings?
> 
> I think Python should reevaluate the default values.

That would break code that relies on the current behaviour. That makes it
a "maybe" for Python 3.0, and an absolute "NO!!!" for Python 2.x.



-- 
Steven.





More information about the Python-list mailing list