I think it's wonderful that Python 3000 will have the nonlocal keyword allowing complete lexical closures. I've just downloaded Python 3.0 a2 and tried the following code:
def accumulator(n): def foo(x): nonlocal n n = n + x return n return foo ... and it works!!! (Now let's see what Paul Graham has to say ... ;) ) However, I've also tried this: def accumulator(n): return lambda x: nonlocal n = n + x and unfortunately it gave me a syntax error. I don't see any reason why this kind of code should not be possible. What do you all think? -- Rocco Rossi ----------------------------------------------------------------- "Alcuni vedono le cose come sono e dicono perché? Io sogno cose non ancora esistite e chiedo perché no?" G.B. Shaw
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com