Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-20408: Fix memoryview() signature in docs. #24431

Merged
merged 1 commit into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ are always available. They are listed here in alphabetical order.


.. _func-memoryview:
.. class:: memoryview(obj)
.. class:: memoryview(object)
:noindex:

Return a "memory view" object created from the given argument. See
Expand Down
15 changes: 7 additions & 8 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3630,17 +3630,16 @@ Memory Views
of an object that supports the :ref:`buffer protocol <bufferobjects>` without
copying.

.. class:: memoryview(obj)
.. class:: memoryview(object)

Create a :class:`memoryview` that references *obj*. *obj* must support the
buffer protocol. Built-in objects that support the buffer protocol include
:class:`bytes` and :class:`bytearray`.
Create a :class:`memoryview` that references *object*. *object* must
support the buffer protocol. Built-in objects that support the buffer
protocol include :class:`bytes` and :class:`bytearray`.

A :class:`memoryview` has the notion of an *element*, which is the
atomic memory unit handled by the originating object *obj*. For many
simple types such as :class:`bytes` and :class:`bytearray`, an element
is a single byte, but other types such as :class:`array.array` may have
bigger elements.
atomic memory unit handled by the originating *object*. For many simple
types such as :class:`bytes` and :class:`bytearray`, an element is a single
byte, but other types such as :class:`array.array` may have bigger elements.

``len(view)`` is equal to the length of :class:`~memoryview.tolist`.
If ``view.ndim = 0``, the length is 1. If ``view.ndim = 1``, the length
Expand Down