1 """Define names for all type symbols known in the standard interpreter.
3 Types that are part of optional modules (e.g. array) are not listed.
5 from __future__
import generators
9 # Iterators in Python aren't a matter of type but of protocol. A large
10 # and changing number of builtin types implement *some* flavor of
11 # iterator. Don't check the type! Use hasattr to check for both
12 # "__iter__" and "next" attributes instead.
29 StringTypes
= (StringType
, UnicodeType
)
31 StringTypes
= (StringType
,)
33 BufferType
= type(buffer(''))
37 DictType
= DictionaryType
= dict
40 FunctionType
= type(_f
)
41 LambdaType
= type(lambda: None) # Same as FunctionType
43 CodeType
= type(_f
.func_code
)
45 # Execution in restricted environment
50 GeneratorType
= type(g())
56 UnboundMethodType
= type(_C
._m
) # Same as MethodType
58 InstanceType
= type(_x
)
59 MethodType
= type(_x
._m
)
61 BuiltinFunctionType
= type(len)
62 BuiltinMethodType
= type([].append
) # Same as BuiltinFunctionType
64 ModuleType
= type(sys
)
66 XRangeType
= type(xrange(0))
72 tb
= sys
.exc_info()[2]
73 TracebackType
= type(tb
)
74 FrameType
= type(tb
.tb_frame
)
75 except AttributeError:
76 # In the restricted environment, exc_info returns (None, None,
77 # None) Then, tb.tb_frame gives an attribute error
81 SliceType
= type(slice(0))
82 EllipsisType
= type(Ellipsis)
84 DictProxyType
= type(TypeType
.__dict
__)
86 del sys
, _f
, _C
, _x
, generators
# Not for export