Barry> Clearly we need the "as if in" operator:

Why not be more direct?

    x = 0
    def foo():
        x = 1
        def bar():
           x = 2
           def baz():
               x in foo = 3
           x in global += 1

By naming the function in which the binding is to occur you avoid problems
of someone coming along and adding or deleting functions between the
assignment (in baz) and the target of the assignment (x in foo) but then
forgetting to increment or decrement the counters that refer to a fixed
number of levels above the current function.

    Barry> (Personally, I've never really needed this much, but if you have
    Barry> to have it, be explicit! :)

Nor I.  I can't think of any situations in my programming where I've used
nested functions, but I was never a LISPer...

Skip
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to