Status of PEP's?

Jesse W jessw at loop.com
Thu Mar 7 00:14:10 EST 2002


	I feel that this whole idea of picking the _most_obvious_ or 
_most_natural_ or even (as has been said sometimes), _any_ 
_practical_ or _useful_ meaning for the iter protocol for any given 
type is simply a bad idea.  As an example, look at the Warning 
about "for line in file:" thread.  Apparently, the xreadlines method, 
which is called invisibly by the iter method (also called semi-invisibly 
by the use of the in operator), has a problem with not leaving gaps 
in the files it reads.  None of this is at all obvious to the poor user 
using the obvious(and it is _obvious_, just not safe or meaningful) 
syntax of for line in file.  It is probably not even documented, 
because the documentation for the xreadlines method(where the 
explanation for the bug would be listed) is not connected to the 
documentation(wherever it would be) for the syntax trick of iter'ing 
files.  (Where would documentation be on that, actually?)
	This does not directly have to do with PEP 276's int iterator, but 
I believe that it shows a problem with the whole idea of hiding the 
mechanisms of what is going on through _practical_ meanings for 
the iter protocol.

				Jesse Weinstein




More information about the Python-list mailing list