[Tutor] lexical scoping efficiency

Matthew Gordon mrgordon at mit.edu
Tue Nov 21 20:52:05 CET 2006


This isn't python specific, but it seems pertinent to the interests of
this list regardless.

Defining functions inside of other functions seems conceptually neater
than defining those functions in the global environment if they're
never going to be used by anything except that one function. In terms
of efficiency though, it seems terrible to lexically scope because
each time the function is called it will have to reinstantiate the
sub-function.

Anyone have an opinion/suggestion?

- Matt


More information about the Tutor mailing list