[Python-Dev] Explicit Lexical Scoping (pre-PEP?) (original) (raw)
skip at pobox.com skip at pobox.com
Wed Jul 5 15:39:05 CEST 2006
- Previous message: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)
- Next message: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)
- Next message: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]