For the Nth time this year that this has come up, I'll point out yet again that this issue has already been discussed to death before:
[Python-ideas] proto-PEP: Fixing Non-constant Default Arguments http://mail.python.org/pipermail/python-ideas/2007-January/000121.html [Python-3000] pre-PEP: Default Argument Expressions http://mail.python.org/pipermail/python-3000/2007-February/005704.html Result: Evaluating the arguments at runtime rather than definition-time was deemed too magical; the backward compatibility issues make changes unlikely; it's hard to find an acceptable syntax. But hey, if some people want to have another go at it, best of luck. Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com On Sun, Nov 16, 2008 at 8:11 PM, alex23 <[EMAIL PROTECTED]> wrote: > On Nov 17, 12:27 pm, Steve Holden <[EMAIL PROTECTED]> wrote: >> If multiple statements are needed to perform the >> argument initialization, how would you then propose the problem should >> be solved? > > Why, with another function of course! > > def f(x, y=`f_arg_computation(x)`): ... > > Or my personal favourite: > > def f(x, **`f_arg_computation(x)`): ... > > Seriously, though, I agree with Steve; the function body -is- the > place for computation to occur. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list