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

2010-08-12 Thread Sander Sweers
On 12 August 2010 12:07, Sander Sweers wrote: > Deque took 0.009195 seconds > 693.01178383827209 / 10 (default times run by timeit) Messed up the deque results :( Deque took 0.009195 seconds 919.49732708930969 / 10 (default times run by timeit) Greets Sander

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

2010-08-12 Thread Dave Angel
Knacktus wrote: 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 wh

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

2010-08-12 Thread Sander Sweers
On 12 August 2010 09:44, Alan Gauld wrote: >> I'm wondering what's the fastet datatype in python to lookup the last >> element in an ordered collection. > > When in doubt timeit() Out of curiosity I used timeit and lists are faster if we iterate over them one by one. Now this is my first go with

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

2010-08-12 Thread Alan Gauld
"Knacktus" wrote I'm wondering what's the fastet datatype in python to lookup the last element in an ordered collection. When in doubt timeit() But I would expect a standard list to be prettyy fast isf you are only concerned about accessing the last element [-1] Also, the collections will

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

2010-08-11 Thread Knacktus
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