Re: Why we will use obj$func() often
A. Lloyd Flanagan wrote:
[color=blue]
> 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.[/color]
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.
A. Lloyd Flanagan wrote:
[color=blue]
> 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.[/color]
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.
Comment