[Python-Dev] an oddball alternative name for enumerate()
Fri, 26 Apr 2002 12:20:41 -0400
On Friday 26 April 2002 10:33 am, Andrew Koenig wrote:
> What does the function do? It attaches a serial number to each
> element of a sequence. So my first thought was that it should
> be named serialize(), but of course that sounds like it's related
> to parallel processing.
> But what about inventory()? My mental image is of someone going
> around with a bunch of numbered stickers, attaching one to
> every relevant object.
Inventory is a creative alternative, but it brings to mind the tallying of
occurances of each item.
The process of adding a serial number to something is an indexing operation.
A non-programmer, who's job requires very precise use of language, thought
indexing was the most appropriate term for the task as described. Cataloging
was suggested as a weak second, but that term generally applies to assigning
numbers to physical items. Assigning unique identifiers to abstract objects,
such as laws or chemical compounds, is an indexing process.
Unfortunately the PEP has rejected all varations of the term index:
All of the names involving 'index' clashed with usage in database
languages where indexing implies a sorting operation rather than
This seems like a weak reason for rejecting the accurate use of the term
index in Python. Only people who use databases will think the term index
means to sort. Python is a general purpose language. Many Python users will
not find the usage confusing and will find all of the alternative terms
I searched the Python document, using Thomas Heller's nifty "Index for Python
manuals". There are 8 uses of the term index and none of them have to do
with a sorting operation of a database.
I also searched for 'indexing'. There were 0 hits on that term. I would
suggest 'indexing' is the term that most closely describes the action of the
function. My apologies to the database community for any confusion this might
cause them. (Never mind they misused the term in the first place. If they
ment sort then they should have used the word sort.)
If indexing is still rejected then I will continue to be +0 on using