mirror of
https://github.com/python/cpython
synced 2026-09-29 11:35:29 +03:00
bpo-35845: Add order={'C', 'F', 'A'} parameter to memoryview.tobytes(). (#11730)
This commit is contained in:
parent
4860f01ac0
commit
d08ea70464
4 changed files with 59 additions and 10 deletions
|
|
@ -3600,7 +3600,7 @@ copying.
|
|||
Previous versions compared the raw memory disregarding the item format
|
||||
and the logical array structure.
|
||||
|
||||
.. method:: tobytes()
|
||||
.. method:: tobytes(order=None)
|
||||
|
||||
Return the data in the buffer as a bytestring. This is equivalent to
|
||||
calling the :class:`bytes` constructor on the memoryview. ::
|
||||
|
|
@ -3616,6 +3616,13 @@ copying.
|
|||
supports all format strings, including those that are not in
|
||||
:mod:`struct` module syntax.
|
||||
|
||||
.. versionadded:: 3.8
|
||||
*Order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data
|
||||
of the original array is converted to C or Fortran order. For contiguous
|
||||
views, 'A' returns an exact copy of the physical memory. In particular,
|
||||
in-memory Fortran order is preserved. For non-contiguous views, the
|
||||
data is converted to C first. *order=None* is the same as *order='C'*.
|
||||
|
||||
.. method:: hex()
|
||||
|
||||
Return a string object containing two hexadecimal digits for each
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue