<p><br>
On Sep 28, 2011 8:58 AM, "Paul Moore" <<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>> wrote:<br>
><br>
> On 28 September 2011 16:38, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
> > Of course once there's different syntax, the nonlocal declaration in<br>
> > the function is redundant. And clearly I'm back-peddling. :-)<br>
><br>
> If we're back to syntax proposals on the def statement, how about<br>
><br>
> def fn() with i=1, lock=Lock():<br>
>   whatever<br>
><br>
> ? This is basically another bikeshed to paint, though...<br>
><br>
> Paul.<br>
></p>
<p>I also had the same idea with:</p>
<p>def fn() with i=1, lock=Lock():<br>
    Whatever</p>
<p>So I guess it's not unobvious. Though "with" is used for something different unless we disallow</p>
<p>    def fn() with NAME = EXPR:</p>
<p>and instead use</p>
<p>    def fn() with CONTEXT as NAME:</p>
<p>And the existing enter/exit mechanism for initialization.</p>
<p>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.</p>
<p>--Yuval</p>
<div class="gmail_quote">On Sep 28, 2011 8:58 AM, "Paul Moore" <<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>> wrote:<br type="attribution">> On 28 September 2011 16:38, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
>> Of course once there's different syntax, the nonlocal declaration in<br>>> the function is redundant. And clearly I'm back-peddling. :-)<br>> <br>> If we're back to syntax proposals on the def statement, how about<br>
> <br>> def fn() with i=1, lock=Lock():<br>>    whatever<br>> <br>> ? This is basically another bikeshed to paint, though...<br>> <br>> Paul.<br>> _______________________________________________<br>
> Python-ideas mailing list<br>> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>> <a href="http://mail.python.org/mailman/listinfo/python-ideas">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div>