Trouble with inheritance of operator= in C++

If you do not declare copy-assignment operator in a class, the compiler will declare one for you implicitly. The implicitly declared copy-assignment operator will hide any inherited assignment operators (read about “name hiding” in C++), meaning that any inherited assignment operators will become “invisible” to the unqualified name lookup process (which is what happens when … Read more

How are Python in-place operator functions different than the standard operator functions?

First, you need to understand the difference between __add__ and __iadd__. An object’s __add__ method is regular addition: it takes two parameters, returns their sum, and doesn’t modify either parameter. An object’s __iadd__ method also takes two parameters, but makes the change in-place, modifying the contents of the first parameter. Because this requires object mutation, … Read more