[Python-checkins] r84684 - python/branches/py3k/Doc/library/stdtypes.rst
georg.brandl
python-checkins at python.org
Fri Sep 10 22:43:53 CEST 2010
Author: georg.brandl
Date: Fri Sep 10 22:43:53 2010
New Revision: 84684
Log:
release() is probably not the most important method
Modified:
python/branches/py3k/Doc/library/stdtypes.rst
Modified: python/branches/py3k/Doc/library/stdtypes.rst
==============================================================================
--- python/branches/py3k/Doc/library/stdtypes.rst (original)
+++ python/branches/py3k/Doc/library/stdtypes.rst Fri Sep 10 22:43:53 2010
@@ -2313,6 +2313,24 @@
:class:`memoryview` has several methods:
+ .. method:: tobytes()
+
+ Return the data in the buffer as a bytestring. This is equivalent to
+ calling the :class:`bytes` constructor on the memoryview. ::
+
+ >>> m = memoryview(b"abc")
+ >>> m.tobytes()
+ b'abc'
+ >>> bytes(m)
+ b'abc'
+
+ .. method:: tolist()
+
+ Return the data in the buffer as a list of integers. ::
+
+ >>> memoryview(b'abc').tolist()
+ [97, 98, 99]
+
.. method:: release()
Release the underlying buffer exposed by the memoryview object. Many
@@ -2346,24 +2364,6 @@
.. versionadded:: 3.2
- .. method:: tobytes()
-
- Return the data in the buffer as a bytestring. This is equivalent to
- calling the :class:`bytes` constructor on the memoryview. ::
-
- >>> m = memoryview(b"abc")
- >>> m.tobytes()
- b'abc'
- >>> bytes(m)
- b'abc'
-
- .. method:: tolist()
-
- Return the data in the buffer as a list of integers. ::
-
- >>> memoryview(b'abc').tolist()
- [97, 98, 99]
-
There are also several readonly attributes available:
.. attribute:: format
More information about the Python-checkins
mailing list