[New-bugs-announce] [issue7022] Doc update for io module

Pascal Chambon report at bugs.python.org
Wed Sep 30 08:52:42 CEST 2009


New submission from Pascal Chambon <chambon.pascal at gmail.com>:

*Propositions of doc update*

*RawIOBase*.read(n: int) -> bytes

Read up to n bytes from the object and return them. Fewer than n bytes
may be returned if the operating system call returns fewer than n bytes.
If 0 bytes are returned, and n was not 0, this indicates end of file. If
the object is in non-blocking mode and no bytes are available, the call
returns None.


<warning - this proposition requires patching teh current implementation
as well>:
*RawIOBase*.readinto(b: bytearray, [start: int = None], [end: int =
None]) -> int

start and end are used as slice indexes, so that the bytearray taken
into account is actually range = b[start:end] (or b[start:], b[:end] or
b[:], depending on the arguments which are not None).

Read up to len(range) bytes from the object and store them in b, returning
the number of bytes read. Like .read, fewer than len(range) bytes may be
read, and 0 indicates end of file if len(range) is not 0.
None is returned if a non-blocking object has no bytes available. The
length of b is never changed.

----------
assignee: georg.brandl
components: Documentation, IO
messages: 93352
nosy: georg.brandl, pakal
severity: normal
status: open
title: Doc update for io module
type: feature request
versions: Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7022>
_______________________________________


More information about the New-bugs-announce mailing list