Steve Palmer <st...@srpalmer.me.uk> added the comment:

I agree with Karthikeyan that the method does not apply in the io.TextIOBase 
class context.  I'm sorry that I didn't spot the note in the description of 
io.TextIOBase - though I think that it is easy to miss.

I'd suggest that there are two ways to clear this up:

1. change only the documentation to read "Even though IOBase does not declare 
read() or write() because their signatures will vary, implementations and 
clients should consider those methods part of the interface."  (deleting 
reference to readinto())

2. change the standard library for io.TextIOBase to add a method readinto which 
will raise an UnsupportedOperation.

With option 1, the descriptions for io.RawIOBase and io.BufferedIOBase both 
include description of the readinto method, so nothing is lost by removing 
mention of it at the io.IOBase level of the hierarchy.  In any case, readinto() 
is not defined on the io.IOBase class.

>>> 'readinto' not in dir(io.IOBase)
True

With option 2, it feels like this is closer to the design intent of a common 
interface over similar but distinguished classes.  It also avoids removing 
things from the documentation in case someone already has some expectations of 
the behaviour.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35848>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to