[Guido van Rossum]
> @EXPR:
>     CODE
> 
> 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 [1]:
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>


 - Josiah

[1] http://mail.python.org/pipermail/python-dev/2005-March/052239.html
_______________________________________________
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