diff options
author | Georg Brandl <georg@python.org> | 2010-09-10 20:43:53 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-09-10 20:43:53 (GMT) |
commit | 4785916d62aeb97692bab08bb9e77952853084a4 (patch) | |
tree | 8a1a07a5236e048d7acdf6f0e8114dfe2043ecbd /Doc | |
parent | fe7b40533cdd61c7cc69171e476a965389146a28 (diff) | |
download | cpython-4785916d62aeb97692bab08bb9e77952853084a4.zip cpython-4785916d62aeb97692bab08bb9e77952853084a4.tar.gz cpython-4785916d62aeb97692bab08bb9e77952853084a4.tar.bz2 |
release() is probably not the most important method
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/stdtypes.rst | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index b4c3eda..fa895cd 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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 |