Christopher Welborn added the comment:
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'.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue20218>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com