On Tuesday, 19 January 2016 15:42:16 UTC+5:30, Steven D'Aprano  wrote:
 
> [steve@ando ~]$ python -m timeit -s "from collections import deque" 
>     -s "it = iter([i for i in xrange(1000)])" "deque(it, maxlen=0)"
> 1000000 loops, best of 3: 0.913 usec per loop
> 
> 
> [steve@ando ~]$ python -m timeit -s "from collections import deque" 
>     -s "it = (i for i in xrange(1000))" "deque(it, maxlen=0)"
> 1000000 loops, best of 3: 0.965 usec per loop

Thanks Steven, it was really helpful answer.  

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to