C
Csaba Hoch
Hi,
if I write the following:
2
it seems to be exactly equivalent to this:
2
However, if I write invalid code and try to add a list to an int, the
errors will be different:
I found that operator.__add__(1, []) gives the same result as 1+[].
What is the reason behind this difference between the __add__ operator
and int.__add__?
Thank you,
Csaba
if I write the following:
2
it seems to be exactly equivalent to this:
2
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):
NotImplemented>>> (1).__add__([])
I found that operator.__add__(1, []) gives the same result as 1+[].
What is the reason behind this difference between the __add__ operator
and int.__add__?
Thank you,
Csaba