Default parameters

Paul Rubin http
Thu Dec 18 00:24:15 EST 2003


"Greg Ewing (using news.cis.dfn.de)" <g2h5dqi002 at sneakemail.com> writes:
> 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.

In those cases the compiler should notice it and generate appropriate
code to evaluate the default arg just once.  In many of the cases it
can put a static value into the .pyc file.




More information about the Python-list mailing list