[Python-3000] Abilities / Interfaces
Phillip J. Eby
pje at telecommunity.com
Thu Nov 23 05:47:12 CET 2006
At 04:33 PM 11/23/2006 +1300, Greg Ewing wrote:
>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
Calling people names isn't particularly conducive to a technical
discussion... or any other kind of discussion, for that matter. :)
>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.
You're right. We should never reuse words to describe similar things,
because then people would be confused. We should only ever invent *new*
words, because everything is different from everything else. ;-)
More seriously, the purpose of descriptive words like "adapting" is to
allow comparison and the discovery of patterns. If iter() were unique in
all the world, it would make no sense to have a special word that applied
only to it. But it's far from unique...
>(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.)
That kludge, as you call it, is something called idempo... whoops, I
almost used an architecture word there! Whew, that was close! :) Suffice
to say, however, that it is a property shared by other builtins such as
str, int, tuple, and bool, and that many perverted Python developers
actually believe this unspeakable idea is a highly desirable property in a
builtin function or type! Let's not tell them it's really a "kludge",
though, 'cause it might hurt their feelings. :)
crudely-attempting-Tim-Peters-style-humor'ly yours,
--PJE
More information about the Python-3000
mailing list