Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
> it should have > > d.__get__(obj, type(obj)) instead of d.__get__(obj) The objtype argument is optional as shown in all of the examples. The call from object.__getattribute__() always passes in both parameters, even though only the first is required. ################################################################ # Demonstration of __get__() being called with one or two params class A: def __init__(self, x): self.x = x def m(self, y): return self.x * y >>> a = A(10) >>> a.m(5) 50 >>> vars(A)['m'].__get__(a)(5) # objtype is not required 50 >>> vars(A)['m'].__get__(a, A)(5) # objtype may be used 50 ################################################################ # Demonstration of object.__getattribute__ supplying both args class Desc: def __get__(self, *args): return args class B: z = Desc() >>> b = B() >>> b.z (<__main__.B object at 0x109156110>, <class '__main__.B'>) ---------- resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31735> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com