[Python-ideas] With expressions

Cody Piersall cody.piersall at gmail.com
Thu Aug 2 09:10:56 EDT 2018


On Thu, Aug 2, 2018 at 5:24 AM Thomas Nyberg via Python-ideas
<python-ideas at python.org> wrote:
>
> Is it true that Path('file').read_text() closes the file after the read?

A quick look at the source confirms that the file is closed:
https://github.com/python/cpython/blob/master/Lib/pathlib.py#L1174

The docstring is better than the official documentation, in my opinion.

Cody


More information about the Python-ideas mailing list