Reasoning behind nested scope

Chris Cioffi evenprimes at gmail.com
Tue Aug 3 10:24:15 EDT 2004


Why would you want to do this?  The whole point of a nested function,
I thought, was to encapsulate some code in the surrounding function,
usually to make the surrounding function clearer.  If the nested
function is of wider utility it should just be a module level
function.  (Possibly of the quasi private variety Python offers.)

Chris

On Tue, 3 Aug 2004 12:26:15 +0100, Andy Baker <andy at andybak.net> wrote:
[snip]
> (On a side note is there any way to call a nested function from outside the
> parent? I was kind of expecting nested functions to be addressable through
> dot notation like methods are but I can see why that wouldn't be quite
> right. This might be a better question for the tutor list...)
> 
> Andy Baker



-- 
Still searching for an even prime > 2!



More information about the Python-list mailing list