2
Define names for built-in types that aren't directly accessible as a builtin.
6
# Iterators in Python aren't a matter of type but of protocol. A large
7
# and changing number of builtin types implement *some* flavor of
8
# iterator. Don't check the type! Use hasattr to check for both
9
# "__iter__" and "__next__" attributes instead.
12
FunctionType = type(_f)
13
LambdaType = type(lambda: None) # Same as FunctionType
14
CodeType = type(_f.__code__)
18
GeneratorType = type(_g())
22
MethodType = type(_C()._m)
24
BuiltinFunctionType = type(len)
25
BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
27
ModuleType = type(sys)
32
tb = sys.exc_info()[2]
33
TracebackType = type(tb)
34
FrameType = type(tb.tb_frame)
37
# For Jython, the following two types are identical
38
GetSetDescriptorType = type(FunctionType.__code__)
39
MemberDescriptorType = type(FunctionType.__globals__)
41
del sys, _f, _g, _C, # Not for export