Tuple question

Gandalf gandalf at geochemsource.com
Thu Sep 2 21:08:06 CEST 2004


> Please see these recent threads, and read the FAQ:
>
> http://groups.google.ca/groups?threadm=mailman.2685.1093979591.5135.python-list%40python.org 


This is from that thread:

>Note that while .index() makes sense for some sequences,
>such as strings and lists, it doesn't make sense for the
>way in which tuples are "supposed to be used", which is
>as collections of heterogeneous data and not usually as
>simply read-only lists. 

Why it is not useful to have an index() method for collections of heterogeneous data?

Suppose, you have big amount of data stored in tuples (for using less memory).
You may want to extract slices from the tuploes from a given index determined by an object.
This is just an example, however it is quite realistic (e.g. using tuples instead of lists
because there is a huge amount of static data that you need to access quickly).






More information about the Python-list mailing list