[Guido van Rossum]
would become something like
def __block(): CODE EXPR(__block)
I'm not yet sure whether to love or hate it. :-)
Is it preferable for CODE to execute in its own namespace (the above being a literal translation of the given code), or for it to execute in the originally defined namespace?
Deferring to Greg Ewing for a moment : They should be lexically scoped, not dynamically scoped.
Wrapped blocks in an old namespace, I believe, is the way to go, especially for things like...
@synchronize(fooLock): a = foo.method()
I cannot come up with any code for which CODE executing in its own namespace makes sense. Can anyone else?
<discussion on the overlap with PEP 310 removed for brevity>