[Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)
Ethan Furman
ethan at stoneleaf.us
Fri Apr 13 10:11:27 EDT 2018
On 04/13/2018 05:02 AM, Jacco van Dorp wrote:
> 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.
The problem with => is that it's the opposite of >= which means typos would not cause SyntaxError and be hard to spot.
--
~Ethan~
More information about the Python-ideas
mailing list