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

Raymond Hettinger python@rcn.com
Wed, 24 Apr 2002 00:15:08 -0400


From: "Guido van Rossum"

See http://python.org/peps/pep-0279.html

There's one nagging issue that I'd like to revisit. I think I still like the name itemize() better than enumerate(), even though itemize() reminds some people of items(). Somehow that doesn't strike me as a strong argument: the words look pretty different to me. I like itemize() better because (a) it's shorter, and (b) the LaTeX command "\itemize" can produce numbered lists (it can also produce bulleted lists). I'm ready to open this one for a vote. :-)

Voter Information (recap of earlier discussions):

    iterindexed()-- five syllables is a mouthful
    index()      -- nice verb but could be confused the .index() method
    indexed()    -- widely liked however adjectives should be avoided
    indexer()    -- noun did not read well in a for-loop
    count()      -- direct and explicit but often used in other contexts
    itercount()  -- direct, explicit and hated by more than one person
    iteritems()  -- conflicts with key:value concept for dictionaries
    itemize()    -- confusing because amap.items() !=

list(itemize(amap)) enumerate() -- does what is says. four syllables is a little long enum() -- pithy; less clear than enumerate; too similar to enum in other languages where it has a different meaning

All of the names involving 'count' had the further disadvantage of
implying that the count would begin from one instead of zero.

All of the names involving 'index' clashed with usage in database
languages where indexing implies a sorting operation rather than
linear sequencing.

All of the names involving 'items' clash with (key,value) concept
used for dictionaries.

American Heritage definition of itemize:  1. To set down item by
item; list.   2. To list deductions from taxable income on a tax
return.

American Heritage definition of enumerate:  1.  To count off or
name one by one; list.  2. To determine the number of; count.

Raymond Hettinger