On Tue, Apr 24, 2018 at 11:28 AM, Chris Angelico <ros...@gmail.com> wrote:

> On re-thinking this, I think the distinction IS possible, but (a) only
> in function/class scope, not at global; and (b) would be defined in
> terms of lexical position, not run-time. For instance:
>
> def f():
>     (a = 1) # Legal; 'a' has not been used yet
>     a = 2 # doesn't change that
>
> def f(a):
>     (a = 1) # Invalid - 'a' has been used already
>
> def f():
>     while (a = get_next()): # Legal
>         ...

Now *this* is a weird rule. Moving functions around files would become
impossible.

Please experiment with my reference implementation, it already
implements my proposal in full. Loops and inline assignments work as
expected in it.

Yury
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to