Why do operators and methods of built-in types differ
csaba.hoch at gmail.com
Sat Jan 31 12:51:35 CET 2009
if I write the following:
it seems to be exactly equivalent to this:
However, if I write invalid code and try to add a list to an int, the
errors will be different:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'list'
I found that operator.__add__(1, ) gives the same result as 1+.
What is the reason behind this difference between the __add__ operator
More information about the Python-list