Antoine Pitrou added the comment: > One thing I am not seeing is a readlines/writelines in these two > libaries. I still think they would be useful, even without the size > argument for readlines.
readlines() and writelines() aren't used a lot in my experience. > So this is what I am seeing now: > read_text(encoding=None) > readlines_text(encoding=None) ..(or read_textlines?) > read_bytes() > readlines_bytes() > write(data, append=False) ..(mode is decided based on data type) > writelines(lines, append=False) > > ..determining the mode for writelines looks at the first item's type? I would suggest differently: - read_text(encoding, errors, newline) - read_bytes() - write_text(data, encoding, errors, newline) - write_bytes(data) Strictly speaking, write() could be polymorphic, but I think it's nice to have distinct methods 1) out of symmetry with read*() 2) to avoid silently accepting the wrong type. As a reference, https://github.com/mikeorr/Unipath (which is quite popular) has read_file() and write_file() methods. https://github.com/jaraco/path.py has bytes(), text(), write_bytes() and write_text(). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20218> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com