Default Parameters to function!
mwh21 at cam.ac.uk
Wed Mar 15 21:29:55 CET 2000
"Yuriy Gorvitovskiy" <yuriy at centricsoftware.com> writes:
> I want to make a request to the Python developers to change the way of
> default parameters initialization from "when function definition is
> executed" to "when function executed".
Loosely speaking, no chance. Too much code relies on this behaviour
(yes, that's perhaps a bed idea, but it's still true).
> I spend half of the days to figure
> out this problem. This definition not intuitive. If somebody can give me One
> GOOD reason why it this way, I will be appreciate!
What do you want to do instead? Store little code objects for each
default argument and evaluate them each time? I guess efficiency was
the initial reason for this implementation.
very few people approach me in real life and insist on proving they are
drooling idiots. -- Erik Naggum, comp.lang.lisp
More information about the Python-list