
On Sep 28, 2011 8:58 AM, "Paul Moore" <p.f.moore@gmail.com> wrote:
On 28 September 2011 16:38, Guido van Rossum <guido@python.org> wrote:
Of course once there's different syntax, the nonlocal declaration in the function is redundant. And clearly I'm back-peddling. :-)
If we're back to syntax proposals on the def statement, how about
def fn() with i=1, lock=Lock(): whatever
? This is basically another bikeshed to paint, though...
Paul.
I also had the same idea with: def fn() with i=1, lock=Lock(): Whatever So I guess it's not unobvious. Though "with" is used for something different unless we disallow def fn() with NAME = EXPR: and instead use def fn() with CONTEXT as NAME: And the existing enter/exit mechanism for initialization. Though I agree with the protesters that this construct can be an attractive nuisance or an "anti pattern" as Greg Ewing said. Though I haven't yet been able to articulate in which cases. --Yuval On Sep 28, 2011 8:58 AM, "Paul Moore" <p.f.moore@gmail.com> wrote:
On 28 September 2011 16:38, Guido van Rossum <guido@python.org> wrote:
Of course once there's different syntax, the nonlocal declaration in the function is redundant. And clearly I'm back-peddling. :-)
If we're back to syntax proposals on the def statement, how about
def fn() with i=1, lock=Lock(): whatever
? This is basically another bikeshed to paint, though...
Paul. _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas