[Python-Dev] Re: PEP 279 (original) (raw)
Guido van Rossum guido@python.org
Mon, 01 Apr 2002 23:05:52 -0500
- Previous message: [Python-Dev] Evil isinstance()
- Next message: [Python-Dev] Re: PEP 279
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
After some more thinking about the name, I have two contenders left: enumerate() and indexer().
Let me explain why I reject the others:
iterindexed()-- five syllables is a mouthfull
Indeed.
index() -- nice verb but could be confused the .index() method
Indeed.
indexed() -- widely liked however adjectives should be avoided
Indeed.
count() -- direct and explicit but often used in other contexts
In particular, there's a list method by this name. While that's in a different namespace, I think the core language should be careful not to pile too many meanings on the same name.
itercount() -- direct, explicit and hated by more than one person
Did they explain why they hated it? "Hate it" alone doesn't get much credit in my book.
iteritems() -- already used by dictionaries for key:value pairs
Which is a downside to me. The symmetry between (key:value) for mappings and (index:value) for sequences seems appealing but quickly becomes a problem, e.g. "for i in " iterates over the values but "for i in " iterates over the keys.
So now I'd like to choose between enumerate() and indexer(). Any closing arguments?
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Evil isinstance()
- Next message: [Python-Dev] Re: PEP 279
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]