Lawrence D'Oliveiro <l...@geek-central.gen.new_zealand> writes: > In message <20101021235138.609fe...@geekmail.invalid>, Andreas > Waldenburger wrote: > > While not very commonly needed, why should a shared default argument be > > forbidden? > > Because it’s safer to disallow it than to allow it.
Scissors with rounded ends are safer than scissors without. Chopsticks and plastic sporks are safer than metal cutlery. We have sharp things because they're /useful/. Similarly, having mutable objects as argument defaults can be useful. (Based on experience with other languages, I suspect that evaluating the default expression afresh for each call where it's needed would be more useful; but it's way too late to change that now.) -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list