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
Date 2014-01-21.02:16:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390270606.9.0.696572043385.issue20218@psf.upfronthosting.co.za>
In-reply-to
Content
Isn't this something you could do yourself?

import pathlib
def pathread(self, binary=False):
    with self.open('br'if binary else 'r') as fread:
        return fread.read()

def pathwrite(self, data, mode='w'):
    with self.open(mode) as fwrite:
        fwrite.write(data)

		
pathlib.Path.read = pathread
pathlib.Path.write = pathwrite
p = pathlib.Path('/mydir/example.txt')
p.read()
# 'Content from path.\n'

p.write('I am appending.\n', mode='a')
p.read()
# 'Content from path.\nI am appending.\n'


...and what about:
"There should be one-- and preferably only one --obvious way to do it."
History
Date User Action Args
2014-01-21 02:16:46cjwelbornsetrecipients: + cjwelborn, cool-RR
2014-01-21 02:16:46cjwelbornsetmessageid: <1390270606.9.0.696572043385.issue20218@psf.upfronthosting.co.za>
2014-01-21 02:16:46cjwelbornlinkissue20218 messages
2014-01-21 02:16:46cjwelborncreate