This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients cjwelborn, cool-RR, pitrou, serhiy.storchaka
Date 2014-01-23.23:16:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390518995.2293.37.camel@fsol>
In-reply-to <>
> 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, (which is quite
popular) has read_file() and write_file() methods. has bytes(), text(), write_bytes() and
Date User Action Args
2014-01-23 23:16:41pitrousetrecipients: + pitrou, cool-RR, serhiy.storchaka, cjwelborn
2014-01-23 23:16:41pitroulinkissue20218 messages
2014-01-23 23:16:39pitroucreate