Why we will use obj$func() often

A. Lloyd Flanagan alloydflanagan at comcast.net
Fri Apr 30 09:58:20 EDT 2004


Greg Ewing <greg at cosc.canterbury.ac.nz> wrote in message news:<c6kajs$cgj7g$1 at ID-169208.news.uni-berlin.de>...
> Mark Hahn wrote:
> > You cannot.  Yes it literally means the immediately surrounding function.
> > In your example, I can't think of any scheme we've discussed that accesses x
> > in function f.  Python surely cannot.
> 
> Python can't write to it, but at least it can read it.
> Prothon apparently can't even read it.
> 

Actually, when I tried the code I got a NameError.  I don't see why I
would want to access a variable defined in an inner scope from an
outer scope; this seems like a great way to clutter up the namespace
and confuse the issue of what the variable actually refers to.



More information about the Python-list mailing list