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

Fredrik Lundh fredrik@pythonware.com
Fri, 19 Jul 2002 16:42:34 +0200


aahz 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
>=20
>     for line in f.readlines():
>=20
> in any version of Python.

and?  for-in doesn't modify the object returned
by f.readlines(), and never has.

</F>