missing types in module types?

Manlio Perillo NOmanlio_perilloSPAM at libero.it
Sat May 29 02:33:57 EDT 2004


Hi.

I have found that some types are missing from module types:


import types
from types import *

def check_type(obj):
     type_list = [eval(t) for t in dir(types) if t.endswith('Type')]	
     return [[x, type(obj)] for x in type_list if isinstance(obj, x)]


def fun(): pass

cm = classmethod(fun)
sm = staticmethod(fun)
    
p = property()


print check_type(cm)
[[<type 'object'>, <type 'classmethod'>]]

print check_type(sm)
[[<type 'object'>, <type 'staticmethod'>]]

print check_type(fun.__init__)
[[<type 'object'>, <type 'method-wrapper'>]]

print check_type(p)
[[<type 'object'>, <type 'property'>]]



Regards  Manlio Perillo



More information about the Python-list mailing list