[issue46304] Unable to iterate over lines in a file without a block of code

Jason R. Coombs report at bugs.python.org
Sat Jan 8 16:17:57 EST 2022


Jason R. Coombs <jaraco at jaraco.com> added the comment:

Nice reference. Indeed, the [rationale](https://www.python.org/dev/peps/pep-0533/#id15) of that pep gives a similar example and the [background](https://www.python.org/dev/peps/pep-0533/#id3) describes the problem with the solution I've drafted above (it still depends on garbage collection to close the file).

I guess that means that in general, it's not possible to accomplish what I'd like.

As author of the PEP, I'm looping in njs.

----------
nosy: +njs

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46304>
_______________________________________


More information about the Python-bugs-list mailing list