[Python-Dev] Re: PEP 279 revisited (original) (raw)

Alex Martelli aleax@aleax.it
Wed, 24 Apr 2002 11:19:18 +0200


On Wednesday 24 April 2002 09:49 am, Scott Gilbert wrote: ...

> > There doesn't seem to be any single English word that > > captures all of what we mean without ambiguity. > > Not a single VERB -- adjective "numbered" might do. Unfortunately > [...]

If there is no really good name, how about just adopting a new simple, short, word like "each", and letting it become the idiom? for i, v in each(L): print i, v It worked for "zip" right?

I'd just love something like this, but unfortunately the precedent you cite probably does not apply: 'zip' is indeed a verb, 'each' is, alas, not.

What's now named 'enumerate', incidentally, is a type (just like 'tuple', 'dict', 'str' -- all consistently non-verbs, and types rather than functions since a few months), so I'm not quite sure why it should be a verb (what other types' names are verbs, except for the slight ambiguity of 'list' or 'file', which I've always perceived in the noun-sense anyway?).

Of course, if a noun was to be chosen instead, 'enumeration' and 'itemization' would be horrid (long and cumbersome), but maybe some other alternatives could be more appealing. 'items', for example, would be appealing to me personally (by the already mentioned "rough analogy" with a dictionary's .items method -- which turns others off by being only rough and not exact, so that D.items() and items(D) would be different sequences of pairs, albeit with similar structures, for just about any dict D).

Alex