[Python-Dev] Single- vs. Multi-pass iterability
Ka-Ping Yee
ping@zesty.ca
Sat, 20 Jul 2002 05:58:39 -0700 (PDT)
On Fri, 19 Jul 2002, Tim Peters wrote:
> "for" did and does work in accord with a simple protocol, and whether that's
> "destructive" depends on how the specific objects involved implement their
> pieces of the protocol, not on the protocol itself. The same is true of all
> of Python's hookable protocols.
Name any protocol for which the question "does this mutate?" has no answer.
(I ask you to accept that __call__ is a special case.)
> What's so special about "for" that it
> should pretend to deliver purely functional behavior in a highly
> non-functional language?
Who said anything about functional behaviour? I'm not requiring that
looping *never* mutate. I just want to be able to tell *whether* it will.
-- ?!ng