Should Python raise a warning for mutable default arguments?

Christian Heimes lists at cheimes.de
Fri Aug 22 14:41:27 EDT 2008


MRAB wrote:
> Could there be a new special method __mutable__?

Why should we add a new method?

Seriously, why should Python be cluttered and slowed down to warn about 
mutable arguments. It's neither a design flaw nor a surprising feature 
*ONCE* you have understood how functions work. I agree that the behavior 
may be surprising for a newbie but it's logical once you got the big 
picture.

Christian




More information about the Python-list mailing list