Why we will use obj$func() often

Mark Hahn mark at prothon.org
Fri Apr 30 14:46:25 EDT 2004


A. Lloyd Flanagan wrote:

> 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.

I assume you are talking about running that code in Python after removing
the & from &x?

That was supposed to be Prothon code that somehow defined x in function f
from the statement &x = 42, even though that statement was in the inner
function h.  The equivalent python code would have the statement x = 42
inside the function f.  Greg was asking if I was claiming that Prothon could
do this "magic" somehow from function h (which Prothon cannot).

We were always talking about an x local to f being referred to in h.





More information about the Python-list mailing list