Message387632
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. |
|
Date |
User |
Action |
Args |
2021-02-24 17:25:37 | mark.dickinson | set | recipients:
+ mark.dickinson, esoma, andribas404 |
2021-02-24 17:25:37 | mark.dickinson | set | messageid: <1614187537.38.0.46890406504.issue43310@roundup.psfhosted.org> |
2021-02-24 17:25:37 | mark.dickinson | link | issue43310 messages |
2021-02-24 17:25:37 | mark.dickinson | create | |
|