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

elderic elderic at ish.de
Thu Nov 2 11:06:49 CET 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