[Python-Dev] Single- vs. Multi-pass iterability

Aahz aahz@pythoncraft.com
Fri, 19 Jul 2002 10:23:49 -0400


On Fri, Jul 19, 2002, Ka-Ping Yee wrote:
>
> I believe this is where the biggest debate lies: whether "for" should be
> non-destructive.  I realize we are currently on the other side of the
> fence, but i foresee enough potential pain that i would like you to
> consider the value of keeping "for" loops non-destructive.

Consider

    for line in f.readlines():

in any version of Python.  Adding iterators made this more convenient
and efficient, but I just can't see your POV in the general case.
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/