Gabriel Genellina wrote:
The operator "+" does more than blindy calling left.__add__(right). In
this case, as int + list returns NotImplemented, it reverses the
operands and tries right.__radd__(left), and only then it gives up and
raises TypeError.
The actual rules are a bit more complex, in
Hi,
if I write the following:
>>> 1+1
2
it seems to be exactly equivalent to this:
>>> (1).__add__(1)
2
However, if I write invalid code and try to add a list to an int, the
errors will be different:
>>> 1+[]
Traceback (most recent call last):
File "", line 1, in
T