On 2019-02-27 17:37, Guido van Rossum wrote:
On Wed, Feb 27, 2019 at 9:34 AM George Castillo <[email protected] <mailto:[email protected]>> wrote:

        The key conundrum that needs to be solved is what to do for `d1
        + d2` when there are overlapping keys. I propose to make d2 win
        in this case, which is what happens in `d1.update(d2)` anyways.
        If you want it the other way, simply write `d2 + d1`.


    This would mean that addition, at least in this particular instance,
    is not a commutative operation.  Are there other places in Python
    where this is the case?


Yes there are. 'a' + 'b' is not the same as 'b' + 'a'.

For non-numbers we only require + to be associative, i.e. a + b + c == (a + b) + c == a + (b + c).

That is satisfied for this proposal.
Are there any advantages of using '+' over '|'?
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to