[Python-Dev] summing integer and class

2013-10-03 Thread Igor Vasilyev
Hi. Example test.py: class A(): def __add__(self, var): print(I'm in A class) return 5 a = A() a+1 1+a Execution: python test.py I'm in A class Traceback (most recent call last): File ../../test.py, line 7, in module 1+a TypeError: unsupported operand type(s) for +:

[Python-Dev] summing integer and class

2013-10-03 Thread Игорь Васильев
Hi. Example test.py: class A():     def __add__(self, var):     print(I'm in A class)     return 5 a = A() a+1 1+a Execution: python test.py I'm in A class Traceback (most recent call last):   File ../../test.py, line 7, in module     1+a TypeError: unsupported operand type(s) for +:

Re: [Python-Dev] summing integer and class

2013-10-03 Thread Chris Angelico
On Thu, Oct 3, 2013 at 11:09 PM, Игорь Васильев vasilyev_i...@inbox.ru wrote: When we adding class to integer we have both slotv and slotw. x = slotv(v, w); - returns Py_NotImplemented. But in this case we should execute x = slotw(v, w); and function should be completed in the same way as when

Re: [Python-Dev] summing integer and class

2013-10-03 Thread Xavier Morel
On 2013-10-03, at 15:45 , Igor Vasilyev wrote: Hi. Example test.py: class A(): def __add__(self, var): print(I'm in A class) return 5 a = A() a+1 1+a Execution: python test.py I'm in A class Traceback (most recent call last): File ../../test.py, line 7, in

Re: [Python-Dev] summing integer and class

2013-10-03 Thread Chris Kaynor
This list is for development OF Python, not for development in python. For that reason, I will redirect this to python-list as well. My actual answer is below. On Thu, Oct 3, 2013 at 6:45 AM, Igor Vasilyev igor.vasil...@oracle.com wrote: Hi. Example test.py: class A(): def

Re: [Python-Dev] summing integer and class

2013-10-03 Thread Greg Ewing
Igor Vasilyev wrote: class A(): def __add__(self, var): print(I'm in A class) return 5 a = A() a+1 1+a Execution: python test.py I'm in A class Traceback (most recent call last): File ../../test.py, line 7, in module 1+a TypeError: unsupported operand type(s) for +: