Stéphane Wirtel | cbb6484 | 2019-05-17 11:55:34 +0200 | [diff] [blame] | 1 | .. highlight:: c |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 2 | |
3 | |||||
4 | .. _concrete: | ||||
5 | |||||
6 | ********************** | ||||
7 | Concrete Objects Layer | ||||
8 | ********************** | ||||
9 | |||||
10 | The functions in this chapter are specific to certain Python object types. | ||||
11 | Passing them an object of the wrong type is not a good idea; if you receive an | ||||
12 | object from a Python program and you are not sure that it has the right type, | ||||
13 | you must perform a type check first; for example, to check that an object is a | ||||
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 14 | dictionary, use :c:func:`PyDict_Check`. The chapter is structured like the |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 15 | "family tree" of Python object types. |
16 | |||||
17 | .. warning:: | ||||
18 | |||||
19 | While the functions described in this chapter carefully check the type of the | ||||
Serhiy Storchaka | f2ba17b | 2019-10-30 21:36:33 +0200 | [diff] [blame^] | 20 | objects which are passed in, many of them do not check for ``NULL`` being passed |
21 | instead of a valid object. Allowing ``NULL`` to be passed in can cause memory | ||||
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 22 | access violations and immediate termination of the interpreter. |
23 | |||||
24 | |||||
25 | .. _fundamental: | ||||
26 | |||||
27 | Fundamental Objects | ||||
28 | =================== | ||||
29 | |||||
30 | This section describes Python type objects and the singleton object ``None``. | ||||
31 | |||||
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 32 | .. toctree:: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 33 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 34 | type.rst |
35 | none.rst | ||||
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 36 | |
37 | |||||
38 | .. _numericobjects: | ||||
39 | |||||
40 | Numeric Objects | ||||
41 | =============== | ||||
42 | |||||
43 | .. index:: object: numeric | ||||
44 | |||||
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 45 | .. toctree:: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 46 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 47 | long.rst |
48 | bool.rst | ||||
49 | float.rst | ||||
50 | complex.rst | ||||
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 51 | |
52 | |||||
53 | .. _sequenceobjects: | ||||
54 | |||||
55 | Sequence Objects | ||||
56 | ================ | ||||
57 | |||||
58 | .. index:: object: sequence | ||||
59 | |||||
60 | Generic operations on sequence objects were discussed in the previous chapter; | ||||
61 | this section deals with the specific kinds of sequence objects that are | ||||
62 | intrinsic to the Python language. | ||||
63 | |||||
Georg Brandl | 60bad0e | 2008-01-05 21:16:33 +0000 | [diff] [blame] | 64 | .. XXX sort out unicode, str, bytes and bytearray |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 65 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 66 | .. toctree:: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 67 | |
Benjamin Peterson | dae32c1 | 2008-05-26 15:01:55 +0000 | [diff] [blame] | 68 | bytes.rst |
Benjamin Peterson | fbeb6b6 | 2008-05-26 16:04:49 +0000 | [diff] [blame] | 69 | bytearray.rst |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 70 | unicode.rst |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 71 | tuple.rst |
72 | list.rst | ||||
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 73 | |
74 | |||||
75 | .. _mapobjects: | ||||
76 | |||||
Victor Stinner | e8453bc | 2013-11-07 22:05:48 +0100 | [diff] [blame] | 77 | Container Objects |
78 | ================= | ||||
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 79 | |
80 | .. index:: object: mapping | ||||
81 | |||||
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 82 | .. toctree:: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 83 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 84 | dict.rst |
Victor Stinner | e8453bc | 2013-11-07 22:05:48 +0100 | [diff] [blame] | 85 | set.rst |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 86 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 87 | |
88 | .. _otherobjects: | ||||
89 | |||||
Victor Stinner | e8453bc | 2013-11-07 22:05:48 +0100 | [diff] [blame] | 90 | Function Objects |
91 | ================ | ||||
92 | |||||
93 | .. toctree:: | ||||
94 | |||||
95 | function.rst | ||||
96 | method.rst | ||||
97 | cell.rst | ||||
98 | code.rst | ||||
99 | |||||
100 | |||||
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 101 | Other Objects |
102 | ============= | ||||
103 | |||||
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 104 | .. toctree:: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 105 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 106 | file.rst |
107 | module.rst | ||||
108 | iterator.rst | ||||
109 | descriptor.rst | ||||
110 | slice.rst | ||||
Antoine Pitrou | c663b58 | 2010-09-28 23:59:51 +0000 | [diff] [blame] | 111 | memoryview.rst |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 112 | weakref.rst |
Benjamin Peterson | b173f78 | 2009-05-05 22:31:58 +0000 | [diff] [blame] | 113 | capsule.rst |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 114 | gen.rst |
Yury Selivanov | 5376ba9 | 2015-06-22 12:19:30 -0400 | [diff] [blame] | 115 | coro.rst |
Elvis Pranskevichus | b2f5f59 | 2018-05-22 13:31:56 -0400 | [diff] [blame] | 116 | contextvars.rst |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 117 | datetime.rst |