Author cjwelborn
Recipients cjwelborn, cool-RR, pitrou, serhiy.storchaka
Date 2014-01-23.21:33:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390512798.7.0.597197950615.issue20218@psf.upfronthosting.co.za>
In-reply-to
Content
Oops, I did. Thanks for that.

So setContent overwrites the file like open('myfile', 'w').write() would, except it has an option to give the temporary file a different extension (in case of a crash while writing). That's understandable for Twisted.
getContent returns a file-like object, which is more like Path's open().

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.

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?

The regular writelines fails with 'must be str, not [insert wrong type]' when opened with 'w', and '[insert wrong type] does not support the buffer interface' when opened with 'wb'.
History
Date User Action Args
2014-01-23 21:33:18cjwelbornsetrecipients: + cjwelborn, pitrou, cool-RR, serhiy.storchaka
2014-01-23 21:33:18cjwelbornsetmessageid: <1390512798.7.0.597197950615.issue20218@psf.upfronthosting.co.za>
2014-01-23 21:33:18cjwelbornlinkissue20218 messages
2014-01-23 21:33:18cjwelborncreate