On Thu, 2 Aug 2018 at 11:25, Thomas Nyberg via Python-ideas <python-ideas@python.org> wrote: > > Is it true that Path('file').read_text() closes the file after the read? > I think that is the sort of functionality that Ken is asking for. > It's not clear to me by your linked documentation that it does. If it > does, maybe that should be made more clear in that linked documentation? > (Of course, maybe it's written there somewhere and I'm just blind...)
I'm not sure I see why you think it wouldn't - opening and closing the file is a purely internal detail of the function. In any case, you don't get given a file object, so how could anything *other* than the read_text() close the file? So you're basically asking "does Path.read_text() have a bug that causes it to leak a filehandle?" to which my answer would be "I assume not, until someone demonstrates such a bug". But if someone wanted to raise a doc bug suggesting that we mention this, I'm not going to bother objecting... Paul _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/