Why has [].__str__ a different type than object.__str__? Why is object.__str__ a routine while object().__str__ not?
Well, I don't know why inspect.isroutine does what it does, but if you really need to detect these, can you do something like:
py> MethodWrapperType = type(object().__str__) py> type([].__str__) == MethodWrapperType True
This is basically all the types module does for similar types. (Take a look -- it's written in Python.)
Some more investigation shows that also the module "types" is not universally usable. E.g. InstanceType is only usabel for instances of old classes. How do I test for instances of new classes?
isinstance(obj, object)
All new-style classes are subclasses of object (even type!)
STeVe -- http://mail.python.org/mailman/listinfo/python-list