[Python-ideas] Documenting Python warts

Chris Angelico rosuav at gmail.com
Wed Jan 2 09:12:25 CET 2013


On Wed, Jan 2, 2013 at 6:29 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Let's call them a compromise then, but calling them a language feature
> sounds delusional. I can't remember ever taking advantage of the fact
> that mutable default arguments are shared accross function invocations.

One common use is caching, as I mentioned earlier (with a contrived
example). Another huge benefit is efficiency - construct a heavy
object once and keep using it. There are others.

It's a feature that can bite people, but no less a feature for that.

ChrisA



More information about the Python-ideas mailing list