[Python-Dev] The iterator story

David Abrahams David Abrahams" <david.abrahams@rcn.com
Fri, 19 Jul 2002 10:40:17 -0400


From: "Alex Martelli" <aleax@aleax.it>

> PEP 246 cannot in any way impede "something" (or more likely "somebody")
from
> writing inappropriate or totally incorrect code, nor will it even try.
Maybe
> I'm missing your point...?

Maybe, or maybe not. I guess if the reiterable sequence adapter says
"list(x)", nobody should be using it to find out whether a thing is
reiterable. Or maybe the reiterable sequence adapter shouldn't say
"list(x)" because that's destructive -- though that begs the question of
finding out whether x is reiterable.

Maybe the PEP is just a red herring as far as the iterator problem is
concerned. As long as the language has built-in facilities like 'for' and
'in' which use iteration protocols at the core of the language,
re-iterability ought to be expressible likewise, in core language terms,
regardless of the more-extensible mechanisms of PEP 246.

whole-pile-of-maybes-ly y'rs,
dave