On 5/8/2012 3:14 PM Alan Gauld said...
On 08/05/12 19:42, Emile van Sebille wrote:
>>> from types import *
>>> def test():pass
...
>>> function=FunctionType
>>> print isinstance(test,function)
Wow, thanks for that. I knew about all the different function types in
there but hadn't realised that FunctionType was the grandaddy of them
all... although I should probably have guessed there would be a parent
class.
Yes -- but not quite the grandaddy... :)
>>> class Test:
... def testm(self):pass
...
>>> T=Test.testm
>>> print isinstance(T,function)
False
>>> print isinstance(T,MethodType)
True
>>>
your point elsewhere re callable is likely more relevant to the OP but
who knows...
Emile
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor