[issue20218] Add `pathlib.Path.write` and `pathlib.Path.read`
Christopher Welborn
report at bugs.python.org
Thu Jan 23 21:37:24 CET 2014
Christopher Welborn added the comment:
Django: https://docs.djangoproject.com/en/dev/ref/files/file/#django.core.files.File
It looks like Django has a File object that wraps around Python's built-in file object. It offers a 'mode' attribute, and a read(num_bytes=None) / write([content]) function. It also offers __iter__ functionality. You must open the file, and then wrap it with File() like:
myfile = File(open('myfile.txt', 'r'))
Twisted: http://twistedmatrix.com/documents/current/api/twisted.python.filepath.FilePath.html
Looking at twisted.python.filepath.FilePath, it looks like there is no read/write.
These are two very popular frameworks/libraries, but I'll see if I can't find other sources for inspiration.
I think read_bytes/read_text would offer a good alternative method for reading files, instead of trying to create a full-on replacement like the previous patches attempt to do.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20218>
_______________________________________
More information about the Python-bugs-list
mailing list