]> granicus.if.org Git - python/commitdiff
release() is probably not the most important method
authorGeorg Brandl <georg@python.org>
Fri, 10 Sep 2010 20:43:53 +0000 (20:43 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 10 Sep 2010 20:43:53 +0000 (20:43 +0000)
Doc/library/stdtypes.rst

index b4c3eda93780183dc80d484e9f9b95386de1d54e..fa895cdeab80fc2d22894a8eb105496f1439e4bc 100644 (file)
@@ -2313,6 +2313,24 @@ is generally interpreted as simple bytes.
 
    :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 @@ is generally interpreted as simple bytes.
 
       .. 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