[issue39863] Add trimend option to readline() and readlines()

Serhiy Storchaka report at bugs.python.org
Thu Mar 5 13:22:59 EST 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

It would be better to name it keepends and set it True by default.

I wanted this feature. The problem is that it is not just concrete implementation, it is an interface. Adding new parameters for IOBase methods will break all IOBase subclasses. And there are IOBase subclasses in third-party code.

It is also not good for file-like classes which do not inherit IOBase, but implement a part of methods. You can't start to use new arguments in your code if you accepted arbitrary file-like objects that have methods read() and readline().

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39863>
_______________________________________


More information about the Python-bugs-list mailing list