News for hackers. Stuff that matters.
Re:Why Operators Are Useful by vivekseth on Saturday March 16, 2019 @02:00PM (#19409178)
If a+b != b+a that breaks the commutativity property of addition.
Re:Why Operators Are Useful by davidwtbuxton on Saturday March 16, 2019 @02:41PM (#19409405)
Yes, but I still want this for combining dictionaries. Python already violates this property, I don't find it confusing.

    Python 3.7.2 (default, Dec 30 2018, 08:55:50) 
    [Clang 10.0.0 (clang-1000.11.45.5)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 'foo' + 'bar' == 'bar' + 'foo'
    False
    >>> ['foo'] + ['bar'] == ['bar'] + ['foo']
    False
Re:Why Operators Are Useful by jcheng on Saturday March 16, 2019 @02:38PM (#19409392)
"a"+"b" != "b"+"a" already.
Re:Why Operators Are Useful by phkahler on Saturday March 16, 2019 @03:42PM (#19409777)
That property is not universal, and it is currently being defined for Python dictionaries. You can't break a property that isn't defined yet. ;-)
Re:Why Operators Are Useful by selimthegrim on Saturday March 16, 2019 @06:26PM (#19410771)
Is this what changed in 3.5?
Re:Why Operators Are Useful by frabert on Saturday March 16, 2019 @02:43PM (#19409423)
Commutatitivity does not need to always hold. Multiplication is not commutative on matrices, but we still use it often and write it as a product nonetheless
Re:Why Operators Are Useful by Koshkin on Saturday March 16, 2019 @09:19PM (#19411546)
In mathematics, the ‘multiplication’ operation is not assumed to be commutative, whereas the ‘addition’ operator is used specifically to indicate commutativity. So, for example, using the plus sign for string concatenation goes against this tradition.
Re:Why Operators Are Useful by whatshisface on Saturday March 16, 2019 @09:29PM (#19411590)
Python actually supports a special operator @ for non-commutative matrix products.
Re:Why Operators Are Useful by dnautics on Saturday March 16, 2019 @06:02PM (#19410607)
To be fair, IEEE fp addition is noncommutative in corner cases.