Finding in which class an object's method comes from

Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
Thu Feb 4 04:37:18 EST 2016


On 04.02.2016 10:00, Chris Angelico wrote:
> On Thu, Feb 4, 2016 at 7:54 PM, ast <nomail at invalid.com> wrote:
>> It is strange but I dont have the same result that you:
>> (Python 3.4)
>>
>>>>> class A:
>>
>> def a(self):pass
>>
>>>>> class B(A):
>> def b(self):pass
>>
>>>>> class C(B):
>> def c(self):pass
>>
>>>>> obj = C()
>>
>>>>> obj.a
>>
>> <bound method C.a of <__main__.C object at 0x02963F90>>
>
> Curious. It appears to have changed between 3.4 and 3.5; my original
> copy/paste was from 3.6.
>

I think http://bugs.python.org/issue21389 causes the difference. I think 
the change was introduced with Python3.5.





More information about the Python-list mailing list