Replace left(), right(), and __reversed__() with the more general purpose

__getitem__() and __setitem__().

Simplifies the API, reduces the code size, adds flexibility, and makes
deques work with bisect.bisect(), random.shuffle(), and random.sample().
This commit is contained in:
Raymond Hettinger 2004-03-01 23:16:22 +00:00
parent 786ea6bc23
commit 0a4977c2f3
4 changed files with 110 additions and 148 deletions

View file

@ -262,7 +262,7 @@ class fifo:
return self.list == []
def first (self):
return self.list.left()
return self.list[0]
def push (self, data):
self.list.append(data)