Mark Dickinson <[email protected]> added the comment:
The key difference between the func_del function and the instance C() is that
func_del is a (non-data) descriptor in addition to being callable, while the
instance C() is not. That makes func_del usable as a method.
If you define C as follows, you'll see the behaviour you expect:
class C:
def __call__(self, *args, **kwargs):
print("call", args, kwargs)
def __get__(self, obj, objtype=None):
return MethodType(self, obj)
Useful reference for descriptors:
https://docs.python.org/3/howto/descriptor.html
I'll close here, since this is neither a bug nor a feature request.
----------
nosy: +mark.dickinson
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43310>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com