tuple.index()

Hendrik van Rooyen mail at microcorp.co.za
Sat Dec 16 00:42:53 EST 2006


 "Christoph Zwerschke" <cito at online.de> wrote:

> I don't think it's a problem of false logic but the problem that
> "homogenous data" is not defined.
>
> We probably agree that it usually makes perfect sense to use tuples for
> coordinates. But in certain mathematical algorithms it also makes sense
> to ask for the number of zero components of a coordinate tuple - the
> count() method would be helpful here.
>
> 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".

>From a practical point of view, the only reason to use a tuple instead
of a list for anything seems to be that you want to use it as a key in a dict...

Otherwise, why bother with these recalcitrant things that you can't
change or index, or append to or anything that lists allow?

- Hendrik




More information about the Python-list mailing list