mutable default parameter problem [Prothon]
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
>> value is needed. The default expression would be evaluated in the
>> 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