nested functions

Terry Reedy tjreedy at udel.edu
Thu Feb 24 18:47:19 EST 2000


"Alexander V. Voinov" <avv at quasar.ipa.nw.ru> wrote in message
news:38B5B649.B0DFB374 at quasar.ipa.nw.ru...

[emailed and posted]

> 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.
Nesting in Python is intended for when you actually want a different
function computed on different calls to the outer function, depending on the
params passed.

For bundling/hiding, one should use classes.

Terry J. Reedy






More information about the Python-list mailing list