Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36378>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to