[Python-ideas] fixing mutable default argument values

Josiah Carlson jcarlson at uci.edu
Sat Jan 27 06:30:00 CET 2007


"Jan Kanis" <jan.kanis at phil.uu.nl> wrote:
> I hope we agree  
> that the problem we're trying to solve is that while
> 
> def f(inlist=None):
>    inlist = inlist if (inlist is not None) else []
> 
> works in the current python, it's non-intuitive and ugly, and it would be  
> nice to have python do 'the right thing' if we can find a nice way to make  
> it do that.

I'm going to have to disagree on the 'non-intuitive and ugly' claim.  We
are just going to have to agree to disagree.


 - Josiah




More information about the Python-ideas mailing list