Efficiency: list or tuple?

Gonçalo Rodrigues op73418 at mail.telepac.pt
Wed Jan 15 12:54:08 EST 2003


On 15 Jan 2003 17:32:25 GMT, Spencer Ernest Doidge <spencer at efn.org>
wrote:

>I'm interested in putting pairs of integers and floats into a sequence 
>of indeterminate length.
>I'm collecting this data in real time, and I want to use the most efficient
>available method so as to be able to gather data as fast as possible and
>append it to the sequence as I go. 
>As far as I can tell, I have lists and tuples to choose from. 
>Does either of these structures work better in this situation, or is
>there some other way I don't know about?

Tuples are immutable, so you don't even have the append method
available. I suppose this does not leave much choice, heh?

Depending on what you want to do, you could also consider dictionaries
(or sets in 2.3).

With my best regards,
G. Rodrigues




More information about the Python-list mailing list