[Python-Dev] PEP 572: Assignment Expressions
Chris Angelico
rosuav at gmail.com
Tue Apr 24 03:32:19 EDT 2018
On Tue, Apr 24, 2018 at 5:23 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Stephen J. Turnbull wrote:
>>
>> Neologisms are usually written in the
>> other order: "dead on arrival (DOA, for short)." ;-)
>
>
> Maybe we can make use of that?
>
> if (x - x_base) (diff) and gcd(diff, n) (g) > 1:
>
> That doesn't work, because the (...) look like function
> calls. But what if we used a different set of bracketing
> characters:
>
> if (x - x_base) {diff} and gcd(diff, n) {g} > 1:
>
> I think that's unambiguous, because you can't currently
> put {...} straight after an expression.
>
> To make it look even more like a neologism definition,
> we could require the bound names to be all-uppercase. :-)
>
> if (x - x_base) {DIFF} and gcd(DIFF, n) {G} > 1:
> return G
>
Great! And to further enhance the neologism parallel, we could allow
them to be defined at the bottom of the program.
if {DIFF} and {G} > 1:
return G
with glossary:
DIFF: x - x_base
G: gcd(DIFF, n)
Definite improvement over all the current proposals!!
ChrisA
More information about the Python-Dev
mailing list