[Python-Dev] Re: PEP 279 revisited

Alex Martelli aleax@aleax.it
Wed, 24 Apr 2002 08:46:19 +0200


On Wednesday 24 April 2002 07:08, Guido van Rossum wrote:
	...
> I don't know about the assertion that enumerate() is clearly going to
> create numbers; the word is uncommon enough that most people might not
> have any preconceived notion of it (certainly not people whose first
> language is not English), 

It has a Latin root ("numerus" == "number"), so people whose first language
is a Romance one are well placed in this way.  For example, "enumerare" is
a common Italian verb (with roughly the same connotations as English
"enumerate", but perhaps more easily felt connection with "numero").

> and for people coming from C, C++ or Pascal
> it may have a strong association with enum types, which are not about
> numbers (in fact they are about abstraction away from numbers ;-).

Right -- "enumerate" as in "exhaustively list" something.  When one does
that in the real world one often attaches numbers to items too (perhaps
silently, on one's fingers) as a help in ensuring exhaustivity, but Pascal 
most definitely doesn't (C/C++ don't hide the numbers so much).


> Your "voter information" didn't mention this as a downside to
> enumerate(), but I think it's at least as important as the only
> argument against itemize (that it's not the same as items()).  I just

I see the itemize/items issue as a _plus_ for itemize -- like items,
it gives a sequence of pairs (x,v), and when the argument S is a
sequence, v==S[x] -- reasonably similar (not "the same", sure, but
if it WAS exactly "the same" we wouldn't have written it) to D.items()
for a dict D returning a sequence [list rather than iterator] of pairs
(x,v) such that v==D[x].  If the function's name didn't _have_ to be
a verb (if it could follow the tradition of other builtin function names
such as dir, vars, len, max and so on), naming the function "items"
would emphasize this analogy.

My problem with "itemize" is that in LaTex and Texinfo it means a
_bulleted_ (UN-numbered) list of items.  In both cases, one uses
"enumerate" instead, if one wants numbers rather than bullets.  But
it may well be that *Tex* are too obscure to worry about that.

> reviewed your implementation and noted that you abbreviated enumerate
> to enum everywhere, thereby closing the door for the "obvious" name
> (at the C API level) for an enum type, should we ever decide to add

Sorry, my fault, not Raymond's -- I was working, as you had suggested,
off the sources of iterobject.c (the 2.2.1 version, with old-fashioned GC,
which doesn't excuse but may explain why I had left the GC in such a
mess), and let the latter's widespread use of the abbreviations "iter_*"
for "iterator" influence me into choosing "enum_*" analogously for
"enumerate".


Alex