Improvements to collections.deque():

* Add doctests for the examples in the library reference.
* Add two methods, left() and right(), modeled after deques in C++ STL.
* Apply the new method to asynchat.py.
* Add comparison operators to make deques more substitutable for lists.
* Replace the LookupErrors with IndexErrors to more closely match lists.
This commit is contained in:
Raymond Hettinger 2004-02-29 02:15:56 +00:00
parent fe99927630
commit 738ec90ca1
4 changed files with 229 additions and 18 deletions

View file

@ -262,11 +262,7 @@ class fifo:
return self.list == []
def first (self):
it = iter(self.list)
try:
return it.next()
except StopIteration:
raise IndexError
return self.list.left()
def push (self, data):
self.list.append(data)