#!/usr/local/bin/python2 from collections import deque for i in xrange(100000): l = range(20) d = deque(l) l.pop(0) print l