nested functions
François Pinard
pinard at iro.umontreal.ca
Thu Feb 24 21:06:15 EST 2000
"Terry Reedy" <tjreedy at udel.edu> writes:
> "Alexander V. Voinov" <avv at quasar.ipa.nw.ru> wrote:
> > Please remind me, if there are any performance penalties in nesting
> > functions like this:
> [snip]
> The definition of a nested function is re-executed everytime the outer
> function is called.
I would guess that the penalty is quite insignificant. The function has
been compiled once and for all with the rest, and the `def' "execution"
is nothing a mere assignment of the function to a local variable. Isn't it?
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list