Default parameters
Greg Ewing (using news.cis.dfn.de)
g2h5dqi002 at sneakemail.com
Thu Dec 18 00:25:27 EST 2003
Stian Søiland wrote:
> When is this issue going to be resolved? Enough newbie-pythoners have
> made this mistake now.
Changes are rarely if ever made to Python for the sole reason
of reducing newbie mistakes. There needs to be a payoff for
long-term use of the language as well.
In this case, evaluating the default args at call time would
have a negative payoff, since it would slow down every call to
the function in cases where the default value doesn't need
to be evaluated more than once.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list