[Cython] callable() optimization
stefan_ml at behnel.de
Wed May 9 09:19:36 CEST 2012
Vitja Makarov, 08.05.2012 13:27:
> I've noticed regression related to callable() optimization.
> class C:
> 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(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.
Ah, right - old style classes are special cased in Py2.
I'll make this a Py3-only optimisation then.
More information about the cython-devel