[Cython] callable() optimization
Vitja Makarov
vitja.makarov at gmail.com
Tue May 8 13:27:28 CEST 2012
I've noticed regression related to callable() optimization.
https://github.com/cython/cython/commit/a40112b0461eae5ab22fbdd07ae798d4a72ff523
class C:
pass
print callable(C())
It prints True optimized version checks ((obj)->ob_type->tp_call !=
NULL) condition that is True for both class and instance.
>>> help(callable)
callable(...)
callable(object) -> bool
Return whether the object is callable (i.e., some kind of function).
Note that classes are callable, as are instances with a __call__() method.
--
vitja.
More information about the cython-devel
mailing list