[Python-Dev] The iterator story

Alex Martelli aleax@aleax.it
Fri, 19 Jul 2002 16:30:41 +0200


On Friday 19 July 2002 04:15 pm, David Abrahams wrote:
	...
> Incidentally, I'm not sure whether PEP 246 provides much help here. If the
> adaptation protocol only gives us a way to say "is this, or can this be
> adapted to be a re-iterable sequence", something could easily answer:

Yes: that's all PEP 246 provides -- a unified way to express a request for
adaptation of an object to a protocol, with the ability for the object's type,
the protocol, AND a registry of installable adapters, to have a say about it
(the registry is not well explained in the PEP as it stands, it's part of what
I have to clarify when I rewrite it -- but my rewrite won't change what's
being discussed in your quoted paragraph and the start of this one).

>     [ x for x in y ]

or more concisely and speedily list(y).

> Which would produce a re-iterable sequence, but might also destroy the
> source. Of course, I'll say up front I've only skimmed the PEP and might've
> missed something crucial.

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...?


Alex