[Python-ideas] Re: pathlib.Path(...).json() (again)

2021-07-10 Thread Thomas Grainger
It's a utility method, so its usefulness derives from being available everywhere without having to patch it in. For me what's changed is the introduction of `asyncio.to_thread` and PEP 597 making `pathlib.Path.open` slightly less ergonomic, ___ Python

[Python-ideas] Re: pathlib.Path(...).json() (again)

2021-07-10 Thread Thomas Grainger
> It opens the file in the main thread, and not asynchronously, but doesn't the file itself get read in the other thead, asynchronously? And is there any extra RAM used? The file could be on an external network drive and so opening it may block the main thread for seconds: ``` with open(the_path

[Python-ideas] Re: pathlib.Path(...).json() (again)

2021-07-10 Thread Steven D'Aprano
On Sat, Jul 10, 2021 at 09:21:14AM -, Thomas Grainger wrote: > It's a utility method, so its usefulness derives from being available > everywhere without having to patch it in. Don't mistake *convenience* with *usefulness*. It is convenient to have the functionality in the std lib, especial