Commit Graph

17 Commits

Author SHA1 Message Date
Raymond Hettinger b66d33fcd0 Provide an example of defaultdict with non-zero constant factory function. 2007-02-19 19:26:16 +00:00
George Yoshida 3c134a2046 Typo fixes 2006-04-22 15:10:49 +00:00
Andrew M. Kuchling 8ed29143fc Typo fix 2006-04-14 20:32:36 +00:00
Andrew M. Kuchling 121c98cce1 Typo fixes 2006-04-14 12:42:09 +00:00
Raymond Hettinger 4d65af0807 Add section headers and examples. 2006-03-25 23:26:43 +00:00
Guido van Rossum 1968ad32cd - Patch 1433928:
- The copy module now "copies" function objects (as atomic objects).
  - dict.__getitem__ now looks for a __missing__ hook before raising
    KeyError.
  - Added a new type, defaultdict, to the collections module.
    This uses the new __missing__ hook behavior added to dict (see above).
2006-02-25 22:38:04 +00:00
Raymond Hettinger 4aec61e0fc Add a remove() method to collections.deque objects. 2005-03-18 21:20:23 +00:00
Raymond Hettinger 2e6694086f Minor wording and spacing nits. 2004-06-12 07:59:40 +00:00
Raymond Hettinger 0e371f2cb6 Make sure "del d[n]" is properly supported. Was necessary because the
same method that implements __setitem__ also implements __delitem__.
Also, there were several good use cases (removing items from a queue
and implementing Forth style stack ops).
2004-05-12 20:55:56 +00:00
Raymond Hettinger e7169eb9ed Add more examples. 2004-05-09 01:15:01 +00:00
Raymond Hettinger f5f9a370d4 Add an example application to the docs. 2004-04-30 22:52:50 +00:00
Raymond Hettinger 0a4977c2f3 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().
2004-03-01 23:16:22 +00:00
Raymond Hettinger 738ec90ca1 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.
2004-02-29 02:15:56 +00:00
Raymond Hettinger 5c5eb86347 * Incorporate Skip's suggestions for documentation (explain the word deque
comes from and show the differences from lists).
* Add a rotate() method.
2004-02-07 21:13:00 +00:00
Raymond Hettinger c058fd14a9 * Fix ref counting in extend() and extendleft().
* Let deques support reversed().
2004-02-07 02:45:22 +00:00
Raymond Hettinger 3ba85c2e8a Have deques support high volume loads. 2004-02-06 19:04:56 +00:00
Raymond Hettinger e52f3b1e56 Add documentation for collections.deque(). 2004-01-29 07:27:45 +00:00