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 cjwelborn
Recipients cjwelborn, cool-RR, pitrou, serhiy.storchaka
Date 2014-01-24.01:15:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Antoine said:
> 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.

I am starting to see where you are going with this, and I agree with your latest points.

I dropped readlines/writelines. I guess pathlib doesn't have to do *exactly* everything you can do through normal io. They are easy to implement anyway with .split() and .join().

I realize this would not make it into Python for a while (3.5 possibly, if at all), but I went ahead and made a patch anyway because I have time to do so at the moment.

I updated the tests to reflect the latest changes, and made sure all of them still pass. Any criticism/wisdom would be appreciated, as this is my first time dealing with the Python patch process.

The api is what you have, except I put an 'append' option:
    read_text(encoding=None, errors=None, newline=None)
    write_bytes(data, append=False)
    write_text(data, encoding=None, errors=None, newline=None, append=False)
Date User Action Args
2014-01-24 01:15:39cjwelbornsetrecipients: + cjwelborn, pitrou, cool-RR, serhiy.storchaka
2014-01-24 01:15:33cjwelbornsetmessageid: <>
2014-01-24 01:15:33cjwelbornlinkissue20218 messages
2014-01-24 01:15:31cjwelborncreate