#!/usr/local/bin/python2 from collections import deque l = [] e = range(10) for i in xrange(100000): l[:] = e for j in xrange(10): l.pop(0) print l