[Python-Dev] PEP 572: Assignment Expressions (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Apr 24 03:23:43 EDT 2018


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

-- Greg



More information about the Python-Dev mailing list