other ways to check for <type 'function'>?

elderic elderic at ish.de
Thu Nov 2 05:06:49 EST 2006


Hi there,

are there other ways than the ones below to check for <type 'function'>
in a python script?
(partly inspired by wrapping Tkinter :P)

def f():
   print "This is f(). Godspeed!"

1.: --> sort of clumsy and discouraged by the docs as far as I read
import types
type(f) is types.FunctionType

2.: --> I don't like this one at all
def null(): pass
type(f) is type(null)

Basically I'm searching for something like:
"type(f) is func" like in: "type(x) is int"

Any ideas? =)




More information about the Python-list mailing list