mutable default parameter problem [Prothon]

Mark Hahn mark at prothon.org
Fri Jun 18 10:54:43 CEST 2004


Pierre-Frédéric Caillaud wrote:

>> 2) Evaluate the default expression once at each call time when the
>> default
>> value is needed.  The default expression would be evaluated in the
>> context
>> of the function definition (like a closure).
>
>
> I like Choice 2 because I've always wanted to do the following :
>
> def func( x, y=2*x ):

It looks like you will get your wish.  The voting has been pretty much
unanimous for option 2.





More information about the Python-list mailing list