Message93479
Benjamin already replaced hasattr(x, "__call__") with hasattr(type(x),
"__call__") in the Python 3.0 "What's New" in r75090 and r75094, but
this still doesn't match completely the behavior of callable():
>>> class Foo(object): pass
...
>>> foo = Foo()
>>> callable(foo)
False
>>> hasattr(type(foo), '__call__')
True
>>> foo()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'Foo' object is not callable
There are also other places where hasattr(x, "__call__") is still
suggested/used (e.g. PEP3100). |
|
Date |
User |
Action |
Args |
2009-10-03 06:13:29 | ezio.melotti | set | recipients:
+ ezio.melotti, georg.brandl, ncoghlan, benjamin.peterson, milko.krachounov |
2009-10-03 06:13:29 | ezio.melotti | set | messageid: <1254550409.27.0.282122052898.issue7006@psf.upfronthosting.co.za> |
2009-10-03 06:13:27 | ezio.melotti | link | issue7006 messages |
2009-10-03 06:13:27 | ezio.melotti | create | |
|