[Python-Dev] The iterator story

Neal Norwitz neal@metaslash.com
Fri, 19 Jul 2002 18:32:09 -0400


Neil Schemenauer wrote:
> 
> Ka-Ping Yee wrote:
> >     I think "for" should be non-destructive because that's the way
> >     it has almost always behaved, and that's the way it behaves in
> >     any other language [@] i can think of.
> 
> I agree that it can be surprising to have "for" destory the object it's
> looping over.  I myself was bitten once by it.  I'm not yet sure if this
> is something that will repeatedly bite.  I suspect it might. :-(

In what context?  Were you iterating over a file or something else?
I'm wondering if this is a problem, perhaps pychecker could generate
a warning?

Neal