any way to tell at runtime whether a callable is implemented in Python or C ?
rosuav at gmail.com
Fri Sep 26 10:42:39 CEST 2014
On Fri, Sep 26, 2014 at 5:47 PM, Wolfgang Maier
<wolfgang.maier at biologie.uni-freiburg.de> wrote:
> is there any reliable and inexpensive way to inspect a callable from running
> Python code to learn whether it is implemented in Python or C before calling
> into it ?
I'm not sure you can say for absolute certain, but the presence of a
__code__ attribute is strongly suggestive that there's Python code
behind the function. That might be good enough for your purposes.
More information about the Python-list