[Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)
Jacco van Dorp
j.van.dorp at deonet.nl
Fri Apr 13 08:02:23 EDT 2018
Before, I briefly mentioned the idea if this could be unified with
except/with's "as". To the casual observer, they're really similar.
However, their semantics would be totally different, and people don't
seem to like a unification attempt.
A huge argument against "as" would be to prevent confusion, especially
for new people.
I must admit I like putting the expression first, though. Even if it's
just to make it harder to mix it up with normal assignment. Perhaps =>
could be used - it's a new token, unlike -> which is used to annotate
return values, it's not legal syntax now(so no backwards compatibility
issues), and used a for similar purposes in for example php when
declaring associative arrays.($arr = array("key"=>"value");). I'm not
convinced myself, though.
More information about the Python-ideas
mailing list