tuple.index()

George Sakkis george.sakkis at gmail.com
Fri Dec 15 10:54:44 EST 2006


Christoph Zwerschke wrote:

> The statement "if you are looking for index() or count() for your
> tuples, you're using the wrong container type" is too extreme I think. I
> would agree with "it *may indicate* that you should better use lists".

And also if that statement was correct, I would argue that Python uses
the wrong container type for storing positional arguments. More often
that not, when ones uses *varargs, he expects a homogeneous container
of extra arguments. There are exceptions of course (e.g. range()) where
each of the expected *varargs has distinct semantics, but from my
experience these are far less common than the unlimited-extra-arguments
case.

George




More information about the Python-list mailing list