Why we will use obj$func() often

Greg Ewing greg at cosc.canterbury.ac.nz
Sun Apr 25 23:24:33 EDT 2004


Mark Hahn wrote:
> The advantage of prefix symbols that Ruby and Prothon use right now is that
> the compiler and the program reader don't have to scan the code at all to
> see what scope the var belongs to.  When you see the & you know it's in the
> surrounding function,

Hang on a minute. Do you literally mean the immediately
surrounding function, and not one further out? In

   def f():
     def g():
       def h():
         &x = 42
       h()
     g()
     print x

does the &x in h refer to the x in f? If it does, then I
don't see how you can deduce that in a single pass. If it
doesn't, then how do you refer to the x in f from h?

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list