[Python-3000] Signature of RawIOBase.read() ?

Guido van Rossum guido at python.org
Mon Jul 28 21:15:52 CEST 2008

On Mon, Jul 28, 2008 at 11:45 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> There is an uncertainty in the signature for RawIOBase.read().
> PEP 3116 says:
>    read(n: int) -> bytes
> but current io.py says:
>    def read(self, n: int = -1) -> bytes:
> Is omitting the `n` parameter always supported by RawIOBase implementations?
> (meaning: read up to the end)

In this (and many other) cases I consider io.py to be more correct; I
haven't kept the PEP up to date. Note that None and any negative value
should be treated the same way. Zero OTOH should mean "read nothing".

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-3000 mailing list