Where do nested functions live?
Steven D'Aprano
steve at REMOVE.THIS.cybersource.com.au
Sat Oct 28 05:27:23 EDT 2006
On Sat, 28 Oct 2006 09:59:29 +0200, Fredrik Lundh wrote:
>> where do nested functions live?
>
> in the local variable of an executing function, just like the variable
> "bar" in the following function:
>
> def foo():
> bar = "who am I? where do I live?"
>
> (yes, an inner function is *created* every time you execute the outer
> function. but it's created from prefabricated parts, so that's not a
> very expensive process).
Does this mean I'm wasting my time writing doc strings for nested
functions? If there is no way of accessing them externally, should I make
them mere # comments?
--
Steven.
More information about the Python-list
mailing list