FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-35845: Add order={'C', 'F', 'A'} parameter to memoryview.tobytes(). by skrah · Pull Request #11730 · python/cpython · GitHub

Repository navigation

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

Merged
skrah merged 3 commits into
python:masterfrom
skrah:tobytes
Feb 2, 2019
Merged

skrah merged 3 commits into
python:masterfrom
skrah:tobytes

Conversation

skrah commented Feb 2, 2019 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

Comment thread Doc/library/stdtypes.rst
and the logical array structure.

.. method:: tobytes()
.. method:: tobytes(order=None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should you write it as order='C'?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is that common practice? I'd assume that order='C' means that a function raises a TypeError with a None argument. I supported None because NumPy does, too.

OTOH NumPy also documents the function with order='C', but I assumed that was an oversight or a historical quirk.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ah, I didn't realize that passing None explicitly was supported.

Comment thread Doc/library/stdtypes.rst Outdated

*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. 'A' returns
the data in the existing order. The default order is 'C'.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Need a versionchanged tag for the new argument.

Comment thread Doc/library/stdtypes.rst Outdated

*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. 'A' returns
the data in the existing order. The default order is 'C'.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Rather than "existing order", I would say "physical order" (or more precisely, "'F' if the buffer is Fortran-contiguous, 'C' otherwise"?).

skrah Feb 2, 2019 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes, let's use the more precise version. 'A' does convert non-contiguous buffers to 'C', so it should be mentioned.

Copy link
Copy Markdown

@skrah: Please replace # with GH- in the commit message next time. Thanks!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL