Joe Jevnik added the comment:
"The purpose of callable is to report whether an instance is callable or not"
I am totally with you so far until you get to: "and that information is
available on the instance's class, via the presence of __call__". I don't
understand why this assumption must be made. The following class is totally
valid and callable (in the sense that I can use function call syntax on
instances):
class C(object):
@property
def __call__(self):
return lambda: None
Also, I don't understand why you would mention __iter__, __iter__ respects the
descriptor protocol also:
>>> class C(object):
... @property
... def __iter__(self):
... return lambda: iter(range(10))
...
>>> it = iter(C())
>>> next(it)
0
>>> next(it)
1
>>> next(it)
2
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23990>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com