<p dir="ltr"><br>
On 24 Feb 2014 07:46, "Greg Ewing" <<a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a>> wrote:<br>
><br>
> Nick Coghlan wrote:<br>
><br>
>> Dealing with references from nested closures is the hard part.<br>
><br>
><br>
> I think that could be handled by creating new cells<br>
> for the inner variables each time the inner scope<br>
> is entered.</p>
<p dir="ltr">Yes, it's not hard * in theory*, it's just hard *in practice*, given the current design of CPython's compiler - my perspective is informed by trying to do it for comprehensions and eventually deciding "meh, I'll just use a real closure so they behave *exactly* like generator expressions in a constructor call and I can stop worrying about it".</p>
<p dir="ltr">There's also the fact that even after getting it to work, you have to *document* it in the language reference as a new kind of scope, because it doesn't behave the same way as any of the existing ones. Sure, it only differs from a full closure in a few obscure edge cases, but it still differs.</p>
<p dir="ltr">Cheers,<br>
Nick.<br></p>
<p dir="ltr">><br>
> -- <br>
> Greg<br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a><br>
</p>