Message 338448 - Python tracker

Message338448

Author xtreak
Recipients DaniFojo, ezio.melotti, rhettinger, xtreak
Date 2019-03-20.10:02:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1553076130.15.0.333263361758.issue36378@roundup.psfhosted.org>
In-reply-to
Content
This expands the API where json.load now only accepts open file objects to support str and pathlike objects. This was discussed in https://mail.python.org/pipermail/python-ideas/2017-March/045303.html where there were alternatives proposed as below : 

with path.open() as f: obj = json.load(f)

some_path.write_text(json.dumps(obj), encoding='utf8')
json.loads(some_path.read_text(encoding='utf8'))

Also supporting str and pathlib passes responsibility to json.load to open them and also close them properly? I think this needs a python-ideas discussion if the proposal has something to add other than the previous thread where many alternatives were mentioned for terse code.
History
Date User Action Args
2019-03-20 10:02:10xtreaksetrecipients: + xtreak, rhettinger, ezio.melotti, DaniFojo
2019-03-20 10:02:10xtreaksetmessageid: <1553076130.15.0.333263361758.issue36378@roundup.psfhosted.org>
2019-03-20 10:02:10xtreaklinkissue36378 messages
2019-03-20 10:02:10xtreakcreate