Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > missing types in module types?

Thread Tools

missing types in module types?

Manlio Perillo
Posts: n/a

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
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Types missing from "types"module John Nagle Python 6 06-24-2010 10:32 PM
Re: module docstring, documentation,anything? please note is the module type/object NOT some module Maric Michaud Python 0 06-24-2006 12:42 PM
Can XSD simple types be derived from complex types? Soren Kuula XML 2 12-01-2005 07:51 PM
Where are ref types that are members of value types stored? Sathyaish ASP .Net 2 05-22-2005 07:32 PM
STD types vs C++ intrinsic types Jeremy Cowles C++ 5 08-19-2003 05:33 PM