Message241389
"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 |
|
Date |
User |
Action |
Args |
2015-04-18 01:28:50 | llllllllll | set | recipients:
+ llllllllll, terry.reedy, belopolsky, christian.heimes, ionelmc, Claudiu.Popa, ethan.furman, jedwards |
2015-04-18 01:28:50 | llllllllll | set | messageid: <1429320530.77.0.42065108344.issue23990@psf.upfronthosting.co.za> |
2015-04-18 01:28:50 | llllllllll | link | issue23990 messages |
2015-04-18 01:28:50 | llllllllll | create | |
|