annotate Lib/types.py @ 3216:d00a79ebb027 legacy-trunk

Added missing imgpbm and imgsgi modules
author Jack Jansen <jack.jansen@cwi.nl>
date Thu, 12 Oct 1995 10:23:27 +0000
parents 1f59f2a13312
children ae004a45050f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1680
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 # Define names for all type symbols known in the standard interpreter.
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 # Types that are part of optional modules (e.g. array) are not listed.
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 import sys
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
5
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 NoneType = type(None)
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 TypeType = type(NoneType)
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 IntType = type(0)
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 LongType = type(0L)
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 FloatType = type(0.0)
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
12
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 StringType = type('')
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
14
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 TupleType = type(())
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 ListType = type([])
2438
1f59f2a13312 added DictType as alias for DictionaryType
Guido van Rossum <guido@python.org>
parents: 1917
diff changeset
17 DictType = DictionaryType = type({})
1680
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
18
1917
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
19 def _f(): pass
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
20 FunctionType = type(_f)
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
21 LambdaType = type(lambda: None) # Same as FunctionType
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
22 CodeType = type(_f.func_code)
1680
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
23
1917
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
24 class _C:
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
25 def _m(self): pass
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
26 ClassType = type(_C)
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
27 UnboundMethodType = type(_C._m) # Same as MethodType
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
28 _x = _C()
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
29 InstanceType = type(_x)
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
30 MethodType = type(_x._m)
1680
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
31
1917
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
32 BuiltinFunctionType = type(len)
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
33 BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
1680
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
34
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
35 ModuleType = type(sys)
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
36
1917
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
37 FileType = type(sys.stdin) # XXX what if it was assigned to?
1680
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 XRangeType = type(xrange(0))
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
39
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 try:
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 raise TypeError
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
42 except TypeError:
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
43 TracebackType = type(sys.exc_traceback)
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
44 FrameType = type(sys.exc_traceback.tb_frame)
0a60460e99f0 Two new generally useful modules: types defines names for all built-in types,
Guido van Rossum <guido@python.org>
parents:
diff changeset
45
1917
014a1fb9c646 Cosmetic changes
Guido van Rossum <guido@python.org>
parents: 1680
diff changeset
46 del sys, _f, _C, _x # Not for export