[Tutor] Performance list vs. deque for [-1]

Knacktus knacktus at googlemail.com
Thu Aug 12 07:37:11 CEST 2010


Hi everyone,

I'm wondering what's the fastet datatype in python to lookup the last 
element in an ordered collection. I know about lists, of course, and 
read about deques. As I understand deques have better performance for 
popping and adding elements, but I didn't understand what's the behavior 
for look-up's without any changes to the collection.

I will not pop() out of my ordered collection, and only recently append. 
Also, the collections will be small (about 10-20 elements), but I will 
have huge amount (50000-100000) of those collections which need to be 
processed for certain tasks in my application.

Thanks in advance and cheers,

Jan


More information about the Tutor mailing list