New operators for Python dicts?
New operators for Python dicts?
Posted Mar 5, 2015 14:30 UTC (Thu) by zyga (subscriber, #81533)Parent article: New operators for Python dicts?
I'd like to clarify that __iadd__ and += are not that similar (when compared to __add__ and +).
        
Consider:
a = 1
a += 1
This calls int.__add__ as int.__iadd__ doesn't exist.
+= will always work if + is defined
__iadd__ may not be defined for certain types
 
           