[Python-Dev] assignment expressions: an alternative proposal
Yury Selivanov
yselivanov.ml at gmail.com
Tue Apr 24 11:46:57 EDT 2018
More information about the Python-Dev mailing list
Tue Apr 24 11:46:57 EDT 2018
- Previous message (by thread): [Python-Dev] assignment expressions: an alternative proposal
- Next message (by thread): [Python-Dev] assignment expressions: an alternative proposal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Apr 24, 2018 at 11:28 AM, Chris Angelico <rosuav at 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
- Previous message (by thread): [Python-Dev] assignment expressions: an alternative proposal
- Next message (by thread): [Python-Dev] assignment expressions: an alternative proposal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list