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.
7
# Iterators in Python aren't a matter of type but of protocol. A large
8
# and changing number of builtin types implement *some* flavor of
9
# iterator. Don't check the type! Use hasattr to check for both
10
# "__iter__" and "next" attributes instead.
27
# StringTypes is already outdated. Instead of writing "type(x) in
28
# types.StringTypes", you should use "isinstance(x, basestring)". But
29
# we keep around for compatibility with Python 2.2.
32
StringTypes = (StringType, UnicodeType)
34
StringTypes = (StringType,)
40
DictType = DictionaryType = dict
43
FunctionType = type(_f)
44
LambdaType = type(lambda: None) # Same as FunctionType
46
CodeType = type(_f.func_code)
48
# Execution in restricted environment
53
GeneratorType = type(_g())
58
UnboundMethodType = type(_C._m) # Same as MethodType
60
InstanceType = type(_x)
61
MethodType = type(_x._m)
63
BuiltinFunctionType = type(len)
64
BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
66
ModuleType = type(sys)
74
tb = sys.exc_info()[2]
75
TracebackType = type(tb)
76
FrameType = type(tb.tb_frame)
77
except AttributeError:
78
# In the restricted environment, exc_info returns (None, None,
79
# None) Then, tb.tb_frame gives an attribute error
84
EllipsisType = type(Ellipsis)
86
DictProxyType = type(TypeType.__dict__)
87
NotImplementedType = type(NotImplemented)
89
del sys, _f, _g, _C, _x # Not for export