diff options
author | Stefan Krah <skrah@bytereef.org> | 2015-08-08 14:33:28 +0200 |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2015-08-08 14:33:28 +0200 |
commit | 70e543b266d273217869091b90a3cedbe32b4a2e (patch) | |
tree | 2615139467bb6fa052635ec6f8c53187e600a341 /Doc/glossary.rst | |
parent | 0c51595a784787d8e198af910cb6d79172ee52bb (diff) | |
download | cpython-git-70e543b266d273217869091b90a3cedbe32b4a2e.tar.gz |
Issue #23756: Clarify the terms "contiguous" and "bytes-like object".
Patch by Martin Panter.
Diffstat (limited to 'Doc/glossary.rst')
-rw-r--r-- | Doc/glossary.rst | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Doc/glossary.rst b/Doc/glossary.rst index d00185e386..846c01ae49 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -109,8 +109,10 @@ Glossary A :term:`text file` reads and writes :class:`str` objects. bytes-like object - An object that supports the :ref:`bufferobjects`, like :class:`bytes`, - :class:`bytearray` or :class:`memoryview`. Bytes-like objects can + An object that supports the :ref:`bufferobjects` and can + export a C-:term:`contiguous` buffer. This includes all :class:`bytes`, + :class:`bytearray`, and :class:`array.array` objects, as well as many + common :class:`memoryview` objects. Bytes-like objects can be used for various operations that work with binary data; these include compression, saving to a binary file, and sending over a socket. @@ -169,6 +171,18 @@ Glossary statement by defining :meth:`__enter__` and :meth:`__exit__` methods. See :pep:`343`. + contiguous + .. index:: C-contiguous, Fortran contiguous + + A buffer is considered contiguous exactly if it is either + *C-contiguous* or *Fortran contiguous*. Zero-dimensional buffers are + C and Fortran contiguous. In one-dimensional arrays, the items + must be layed out in memory next to each other, in order of + increasing indexes starting from zero. In multidimensional + C-contiguous arrays, the last index varies the fastest when + visiting items in order of memory address. However, in + Fortran contiguous arrays, the first index varies the fastest. + coroutine Coroutines is a more generalized form of subroutines. Subroutines are entered at one point and exited at another point. Coroutines can be |