I have a list of about 40 entries. And I frequently want to append an item to the start of the list (with id 0) and want to delete the last entry (
list
last
Use collections.deque:
>>> import collections >>> q = collections.deque(["herp", "derp", "blah", "what", "da.."]) >>> q.appendleft('wuggah') >>> q.pop() 'da..' >>> q deque(['wuggah', 'herp', 'derp', 'blah', 'what'])