[Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in

Jim Jewett jimjjewett at gmail.com
Tue Mar 6 18:33:41 CET 2007


On 3/5/07, Ka-Ping Yee <python at zesty.ca> wrote:
> In fact, your example was specifically anticipated and addressed in
> the PEP draft I posted here.  file.read() is not invoked by a language
> construct.  When file.read() gets called, it is because the calling
> code has an explicit call to read() in it, not because the standard
> semantics of some piece of Python syntax require it to be invoked.

Except that the "explicit" call could just be "for line in file",
which doesn't mention read.
And there are warnings not to mix explicit reads with iteration reads,
because buffering will cause surprises.  I think the inconsistency is
in iteration rather than reading, but file.read is affected.

-jJ


More information about the Python-3000 mailing list