mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
bpo-20408: Fix memoryview() signature in docs (GH-24431)
This commit is contained in:
parent
1b940eb410
commit
d18e5dae91
2 changed files with 8 additions and 9 deletions
|
@ -1022,7 +1022,7 @@ are always available. They are listed here in alphabetical order.
|
||||||
|
|
||||||
|
|
||||||
.. _func-memoryview:
|
.. _func-memoryview:
|
||||||
.. class:: memoryview(obj)
|
.. class:: memoryview(object)
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
Return a "memory view" object created from the given argument. See
|
Return a "memory view" object created from the given argument. See
|
||||||
|
|
|
@ -3632,17 +3632,16 @@ Memory Views
|
||||||
of an object that supports the :ref:`buffer protocol <bufferobjects>` without
|
of an object that supports the :ref:`buffer protocol <bufferobjects>` without
|
||||||
copying.
|
copying.
|
||||||
|
|
||||||
.. class:: memoryview(obj)
|
.. class:: memoryview(object)
|
||||||
|
|
||||||
Create a :class:`memoryview` that references *obj*. *obj* must support the
|
Create a :class:`memoryview` that references *object*. *object* must
|
||||||
buffer protocol. Built-in objects that support the buffer protocol include
|
support the buffer protocol. Built-in objects that support the buffer
|
||||||
:class:`bytes` and :class:`bytearray`.
|
protocol include :class:`bytes` and :class:`bytearray`.
|
||||||
|
|
||||||
A :class:`memoryview` has the notion of an *element*, which is the
|
A :class:`memoryview` has the notion of an *element*, which is the
|
||||||
atomic memory unit handled by the originating object *obj*. For many
|
atomic memory unit handled by the originating *object*. For many simple
|
||||||
simple types such as :class:`bytes` and :class:`bytearray`, an element
|
types such as :class:`bytes` and :class:`bytearray`, an element is a single
|
||||||
is a single byte, but other types such as :class:`array.array` may have
|
byte, but other types such as :class:`array.array` may have bigger elements.
|
||||||
bigger elements.
|
|
||||||
|
|
||||||
``len(view)`` is equal to the length of :class:`~memoryview.tolist`.
|
``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
|
If ``view.ndim = 0``, the length is 1. If ``view.ndim = 1``, the length
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue