Steven D'Aprano wrote:
> We're talking about an operator to copy-and-update a dict, not invade
> Iraq.
[grin] Fair enough.
In the interim, actually, I realized some semantic downsides of using pipe.
If a user happens to draw an analogy to logical 'or', the 'which one wins'
semantics is different.
result = 0 or 1 or 2 # result == 1
result = {'foo': 0} | {'foo': 1} | {'foo': 2} # result == {'foo': 2}
Also, the logic flow of pipe from a shell script context is left-to-right, in
contrast to this dict operation:
cmd1 | cmd2 # Information flows left-to-right
d1 | d2 # To know which values are in the result for a given key, read
right-to-left
I withdraw my preference for pipe. I really like the feature, and will gladly
use it with '+'. +1.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/ZHZWMBC6A5XGTHQLMOUAJNFXLUQAACOE/
Code of Conduct: http://python.org/psf/codeofconduct/