Is there a nice way to check whether object o is a builtin Python function?
I know I can use, for example
type(o) == type(pow)
beca
you can also do
import __builtin__
o in __builtin__.__dict__.values()
or, in CPython:
o in __builtins__.__dict__.values()
but note that you rely on an implementation detail here.
>>> pow in __builtins__.__dict__.values()
True
>>> def a():
... pass
...
>>> a in __builtins__.__dict__.values()
False
>>>