Re: Testing if an object is a function

2006-10-05 Thread Claus Tondering
Fredrik Lundh wrote: > if callable(x): Perfect. Thank you. -- Claus Tondering -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing if an object is a function

2006-10-05 Thread Fredrik Lundh
Claus Tondering wrote: > But what do I do if I want to test if x is a function? > > I can do this: > > if isinstance(x, type(lambda: None)): ... > > But it does not seem very elegant to me. > > Surely there is a simpler way to specify a type object that is the type > of a function. if cal