[Python-3000] Abilities / Interfaces

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Nov 23 04:33:34 CET 2006


Phillip J. Eby wrote:

> Consider 'iter()', for example, which can be viewed as adapting an object 
> to the "iteration interface" and returning an object supporting iteration.

An architecture astronaut might view it that way, but
I don't. To my way of thinking, iter(x) creates a new
object that iterates over x. Calling it a form of
adaptation just muddies things with uneccessary words.

(The fact that iter(x) returns x when it's already an
iterator is a distraction. It's really just a kludge
so that the same for-statement syntax can be used on
both iterators and iterables.)

--
Greg


More information about the Python-3000 mailing list