|
2 | 2 |
|
3 | 3 | .. _bufferobjects: |
4 | 4 |
|
5 | | -Buffer API |
6 | | ----------- |
| 5 | +Buffer Protocol |
| 6 | +--------------- |
7 | 7 |
|
8 | 8 | .. sectionauthor:: Greg Stein <[email protected]> |
9 | 9 | .. sectionauthor:: Benjamin Peterson |
@@ -50,21 +50,22 @@ How the buffer interface is exposed by a type object is described in the |
50 | 50 | section :ref:`buffer-structs`, under the description for :ctype:`PyBufferProcs`. |
51 | 51 |
|
52 | 52 |
|
53 | | -Buffer objects |
54 | | -============== |
| 53 | +The buffer structure |
| 54 | +==================== |
55 | 55 |
|
56 | | -Buffer objects are useful as a way to expose the binary data from another |
57 | | -object to the Python programmer. They can also be used as a zero-copy |
58 | | -slicing mechanism. Using their ability to reference a block of memory, it is |
59 | | -possible to expose any data to the Python programmer quite easily. The memory |
60 | | -could be a large, constant array in a C extension, it could be a raw block of |
61 | | -memory for manipulation before passing to an operating system library, or it |
62 | | -could be used to pass around structured data in its native, in-memory format. |
| 56 | +Buffer structures (or simply "buffers") are useful as a way to expose the |
| 57 | +binary data from another object to the Python programmer. They can also be |
| 58 | +used as a zero-copy slicing mechanism. Using their ability to reference a |
| 59 | +block of memory, it is possible to expose any data to the Python programmer |
| 60 | +quite easily. The memory could be a large, constant array in a C extension, |
| 61 | +it could be a raw block of memory for manipulation before passing to an |
| 62 | +operating system library, or it could be used to pass around structured data |
| 63 | +in its native, in-memory format. |
63 | 64 |
|
64 | | -Contrary to most data types exposed by the Python interpreter, buffer objects |
| 65 | +Contrary to most data types exposed by the Python interpreter, buffers |
65 | 66 | are not :ctype:`PyObject` pointers but rather simple C structures. This |
66 | 67 | allows them to be created and copied very simply. When a generic wrapper |
67 | | -around a buffer object is needed, a :ref:`memoryview <memoryviewobjects>` object |
| 68 | +around a buffer is needed, a :ref:`memoryview <memoryviewobjects>` object |
68 | 69 | can be created. |
69 | 70 |
|
70 | 71 |
|
|
0 commit comments