So the way I envision it is that *in the absence of a nonlocal or global
> declaration in the containing scope*, := inside a comprehension or genexpr
> causes the compiler to assign to a local in the containing scope, which is
> elevated to a cell (if it isn't already). If there is an explicit nonlocal
> or global declaration in the containing scope, that is honored.
>

This seems to be getting awfully complicated. Proof? Try to write the docs
for the proposed semantics.

I don't understand why we went so astray from the original requirements,
which could all be met by having `if` and `while` accept `as` to bind an
expression to a variable that would be local to the structured statement.

Cheers,

-- 
Juancarlo *Añez*
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to