tuples, index method, Python's design

Carsten Haese carsten at uniqsys.com
Tue Apr 10 16:20:31 CEST 2007


On Tue, 2007-04-10 at 09:57 -0400, Steve Holden wrote:
> I hear the screams of "just add the index() method to tuples and have 
> done with it" and, to an extent, can sympathize with them. But that way 
> lies creeping featurism and the next thing you know we'll have a ternary 
> operator in the language - oh wait, we do now!

It would indeed be much easier to just give up. However, the resistance
to tuple.index is more than a generic resistance to feature creep. As I
have demonstrated elsewhere on this thread, any use case for tuple.index
will be inherently obfuscated. Code clarity is a major design goal of
Python, and adding tuple.index would be contrary to this goal.

I'm just a user with no influence on the development of Python itself,
but in my humble opinion, the non-existence of tuple.index is more
pythonic than its existence would be.

-Carsten





More information about the Python-list mailing list