This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unreproducible example in the memoryview documentation
Type: Stage:
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: chaica_, docs@python, eric.araujo, pitrou
Priority: normal Keywords:

Created on 2010-07-19 15:25 by chaica_, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg110766 - (view) Author: Carl Chenet (chaica_) Date: 2010-07-19 15:25
Hi,

In the current documentation at http://docs.python.org/library/stdtypes.html#memoryview, the first example announces : 

>>> v = memoryview('abcefg')
>>> v[1]
'b'
>>> v[-1]
'g'
>>> v[1:4]
<memory at 0x77ab28>
>>> str(v[1:4])
'bce'

Trying to reproduce this example I got : 

$ python
Python 2.7 (r27:82500, Jul 13 2010, 17:48:51) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> v = memoryview('abcefg')
>>> v[1]
'b'
>>> v[-1]
'g'
>>> v[1:4]
<memory at 0xa2a510>
>>> str(v[1:4])
'<memory at 0xa2a5a8>'

The last line of the example in the documentation is not reproducible. Hope it's only a documentation issue.

Bye,
Carl Chenet
msg110784 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-07-19 17:13
Right, it should be `v[1:4].tobytes()` instead.
msg110790 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-07-19 18:11
Fixed in r82981. Thank you for the report!
History
Date User Action Args
2022-04-11 14:57:04adminsetgithub: 53550
2010-07-19 18:11:03pitrousetstatus: open -> closed
resolution: fixed
messages: + msg110790
2010-07-19 17:13:09pitrousetmessages: + msg110784
2010-07-19 16:28:29eric.araujosetnosy: + eric.araujo
2010-07-19 16:28:16eric.araujosetnosy: + pitrou
2010-07-19 15:25:51chaica_create