When the __get__, __set__, or __delete__ attribute of a descriptor is not a method, and is instead a generic callable, the first argument of that callable is inconsistent:
class Callable(object):
def __call__(self, first, *args, **kwargs):
print(first)
class Descriptor(object):
__set__ = Callable()
__delete__ = Callable()
__get__ = Callable()
class MyClass(object):
d = Descriptor()
mc = MyClass()
mc.d = 1
del mc.d
mc.d
<__main__.MyClass object at 0x10854cda0>
<__main__.MyClass object at 0x10854cda0>
<__main__.Descriptor object at 0x10855f240>
Why is the owner descriptor passed to the first argument of __get__ callable when this attribute is not technically a "method"? And perhaps more importantly, why is this behavior not consistent across all the descriptor attributes?
What's going on here?