Optional parameter object re-used when instantiating multiple objects
alex23
wuwei23 at gmail.com
Sun Nov 16 23:11:19 EST 2008
On Nov 17, 12:27 pm, Steve Holden <st... at holdenweb.com> 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.
More information about the Python-list
mailing list