Oops -- Lib/Test should be Lib/test, of course!
[python/dscho.git] / Lib / types.py
blobc440a5cdf7709f98d9d9bd9375f68bf8fa0abd7c
1 # Define names for all type symbols known in the standard interpreter.
2 # Types that are part of optional modules (e.g. array) are not listed.
4 import sys
6 NoneType = type(None)
7 TypeType = type(NoneType)
9 IntType = type(0)
10 LongType = type(0L)
11 FloatType = type(0.0)
12 try:
13 ComplexType = type(complex(0,1))
14 except NameError:
15 pass
17 StringType = type('')
19 TupleType = type(())
20 ListType = type([])
21 DictType = DictionaryType = type({})
23 def _f(): pass
24 FunctionType = type(_f)
25 LambdaType = type(lambda: None) # Same as FunctionType
26 try:
27 CodeType = type(_f.func_code)
28 except:
29 pass
31 class _C:
32 def _m(self): pass
33 ClassType = type(_C)
34 UnboundMethodType = type(_C._m) # Same as MethodType
35 _x = _C()
36 InstanceType = type(_x)
37 MethodType = type(_x._m)
39 BuiltinFunctionType = type(len)
40 BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
42 ModuleType = type(sys)
44 try:
45 FileType = type(sys.stdin) # XXX what if it was assigned to?
46 except:
47 pass
48 XRangeType = type(xrange(0))
50 try:
51 raise TypeError
52 except TypeError:
53 try:
54 tb = sys.exc_info()[2]
55 TracebackType = type(tb)
56 FrameType = type(tb.tb_frame)
57 except:
58 pass
59 tb = None; del tb
61 SliceType = type(slice(0))
62 EllipsisType = type(Ellipsis)
64 del sys, _f, _C, _x # Not for export