[Python-Dev] lifting of prohibition against readlines inside a "for line in file" in Py3?

Terry Reedy tjreedy at udel.edu
Wed Feb 18 22:37:34 CET 2009


Mitchell L Model wrote:
> In Digest Vol. 67, Issue 52 (13 Feb 2009) I pointed out that Python 2's 
> prohibition against performing readlines on a file being iterated over 
> appears to have been lifted in Python 3. I asked if this was intentional 
> and whether it should be add to the "What's New" documentation.  I also 
> expressed muy surprise that "for line in fil"'s can be nested using the 
> same fil in both Python 2 and 3. I presented an example for each point 
> and some and further comments.

If I understand, you are asking whether the new behavior is an 
undocumented new feature that you can use or an error that may be 
reverted.  It is possible that it is an accident and there is no answer 
yet decided.

I suspect your original query got lost in the shuffle.  If you do not 
get an answer this time, file an issue on the tracker bugs.python.org 
but do not select whether it is a behavior or doc issue. At least, it 
will stay open until resolved.

tjr



More information about the Python-Dev mailing list