Message267084
I don’t see the point of mentioning array() objects at all. It’s hard to support array in a Python 2 implementation, as demonstrated by readinto(). And the special support for array('b') won’t help if you pass in array('B') with values 128–255. I see this as an implementation detail of _pyio, rather than a need for others to follow its lead.
The array('b') code was added by r56225. I guess it is experimental code from an early phase of the io module. Also, test_array_writes() is disabled for _pyio in 2.7 (https://hg.python.org/cpython/diff/760a710eb6c1/Lib/test/test_io.py), and in 2.6 (http://svn.python.org/view/python/branches/trunk-bytearray/Lib/test/test_io.py?r1=61775&r2=61774&pathrev=61775&view=patch).
I think it is better to avoid “such as” and be specific about what has to be supported. Perhaps:
readinto(b): The object *b* should be a pre-allocated, writable array of bytes, either :class:`bytearray` or :class:`memoryview`.
.. versionchanged:: 2.7
Support for :class:`memoryview`.
write(b): The object *b* should be an array of bytes, either :class:`str`, :class:`bytearray`, or :class:`memoryview`.
.. versionchanged:: 2.7
Support for :class:`memoryview`. |
|
Date |
User |
Action |
Args |
2016-06-03 09:59:13 | martin.panter | set | recipients:
+ martin.panter, pitrou, benjamin.peterson, r.david.murray, docs@python, python-dev, serhiy.storchaka, Henning.von.Bargen |
2016-06-03 09:59:13 | martin.panter | set | messageid: <1464947953.07.0.919133525553.issue20699@psf.upfronthosting.co.za> |
2016-06-03 09:59:13 | martin.panter | link | issue20699 messages |
2016-06-03 09:59:12 | martin.panter | create | |
|