bpo-35845: Add order={'C', 'F', 'A'} parameter to memoryview.tobytes(). (#11730)

This commit is contained in:
Stefan Krah 2019-02-02 18:57:41 +01:00 • committed by GitHub
parent 4860f01ac0
commit d08ea70464
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 10 deletions

View file

@ -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