Commit Graph

108 Commits

Author SHA1 Message Date
Raymond Hettinger 3f2b18495b Other minor clean-ups. 2011-04-24 12:55:28 -07:00
Raymond Hettinger c646743d02 Remove unused branch in the clear() method. Minor comment edits. 2011-04-24 12:30:39 -07:00
Raymond Hettinger 536999c697 Minor code clean-up. 2011-04-23 20:11:50 -07:00
Raymond Hettinger b36f747464 Remove unused imports 2011-04-23 18:37:37 -07:00
Raymond Hettinger 43a5641c0b Minor code simplification. 2011-04-23 15:51:38 -07:00
Raymond Hettinger 0b795e5b36 Minor code simplification. 2011-04-23 15:41:38 -07:00
Raymond Hettinger 7ce6d9763c Cleanups to remove dependencies and add docstrings. 2011-04-22 18:49:53 -07:00
Raymond Hettinger 3674c8591f Minor text rearrangement. 2011-04-20 13:11:38 -07:00
Raymond Hettinger c98556e72e Issue #11875: Alter the previous fix to work better with subclasses 2011-04-19 16:53:07 -07:00
Raymond Hettinger 7cb5ec0e60 Use a generic class lookup. 2011-04-19 09:52:21 -07:00
Raymond Hettinger e0156c43da Issue 11875: Keep OrderedDict's __reduce__ from temporarily mutating the object. 2011-04-19 09:48:39 -07:00
Raymond Hettinger efeb8bdaa2 Rework multiset methods to use less memory and to make fewer calls to __hash__. 2011-04-17 20:08:41 -07:00
Raymond Hettinger 37c0fe56b9 Fix minor subclassing issue with collections.Counter 2011-04-15 13:12:21 -07:00
Raymond Hettinger c886a8484d Backport r87672 and r87615, improving tests, using super() instead of direct parent references, and using __reduce__ method for pickling. 2011-01-03 08:59:18 +00:00
Raymond Hettinger 8ebebd8f7e Raymond-Hettingers-MacBook-Pro:py27 raymondhettinger$ cat svn-commit.tmp
Backport r87594 r87611 and r87612 so that OrderedDict subclassing behavior
better matches dict subclassing (i.e. adding __missing__ works and
extending/overriding the update() methods doesn't break __init__()).
2011-01-02 01:03:26 +00:00
Amaury Forgeot d'Arc 71431ef51a Backport part of r86217: Fix issues when building without threads 2010-11-09 07:35:26 +00:00
Raymond Hettinger 74f869eb94 Issue 9826: OrderedDict.__repr__ did not play well with self-referencing dicts. 2010-09-13 22:14:36 +00:00
Raymond Hettinger 2039753a9a Issue #9825: Remove __del__() from OrderedDict. 2010-09-12 02:11:45 +00:00
Raymond Hettinger a54b2dac90 Issue #9626: Fix views in collections.OrderedDict(). 2010-08-17 19:03:06 +00:00
Raymond Hettinger fdf1b5642b Minor factoring 2010-04-11 20:39:28 +00:00
Raymond Hettinger 34c35b2788 Add subtract() method to collections.Counter() objects. 2010-04-03 10:22:00 +00:00
Raymond Hettinger dd2fedcd1c Factor-out constant expressions 2010-04-03 07:57:09 +00:00
Raymond Hettinger 6b96ecb0ab Improve clear() method. Keeps key/value refcnts >= 1 until final dict.clear() so that decrefs to zero won't trigger arbitrary code . Also runs a bit faster. 2010-04-03 03:14:28 +00:00
Raymond Hettinger 3928276e64 Clear cyclical references in list based OrderedDict. 2010-04-03 00:39:26 +00:00
Raymond Hettinger e30bc38ce9 Improve code clarity a bit. 2010-03-09 11:29:10 +00:00
Raymond Hettinger aba2293862 Have links in OrderedDicts be native Python lists instead
of a custom class with __slots__.  This simplifies the
code a bit, reduces memory consumption, improves speed,
and eliminates the need for weak reference proxies.
2010-03-09 09:58:53 +00:00
Raymond Hettinger 9bd3508530 Add nicer docstrings to namedtuples().
Provides better tooltips and looks better in help().
2010-03-09 09:01:46 +00:00
Georg Brandl 7d4b759bd9 Remove unused import. 2010-02-06 22:49:47 +00:00
Raymond Hettinger 5dfc7f9fc8 Issue 6370: Performance issue with collections.Counter(). 2009-06-29 19:10:29 +00:00
Alexandre Vassalotti cb73bdac95 Revert r73401 per Raymond Hettinger's request.
The rational is the change might cause imcompatiblity problems with
PyYAML. In addition, Raymond wants to kept the different versions of
collections synchronized across Python versions.
2009-06-12 23:03:35 +00:00
Alexandre Vassalotti 450ae573bc Make pickling of OrderedDict instances more efficient. 2009-06-12 21:52:14 +00:00
Raymond Hettinger a68cad13ae Fix field name conflicts for named tuples. 2009-05-27 02:24:45 +00:00
Benjamin Peterson 7c67b03051 using sys._getframe(x), where x > 0 doesnt' work on IronPython 2009-05-05 00:55:24 +00:00
Raymond Hettinger 1355a3dbf6 Minor factoring. 2009-04-08 08:26:55 +00:00
Raymond Hettinger a5cd6375c0 Add docstrings. 2009-04-08 05:39:38 +00:00
Raymond Hettinger e3bc5577e8 Replace the localized min/max calls with normal if/else 2009-04-04 08:46:58 +00:00
Raymond Hettinger 756ab67a98 Have namedtuple's field renamer assign names that
are consistent with the corresponding tuple index.
2009-04-02 22:25:40 +00:00
Raymond Hettinger 2dc90fdfaf Separate initialization from clearing. 2009-03-25 22:41:32 +00:00
Raymond Hettinger e5b78563b6 Make imported name private and wrap long-line. 2009-03-23 18:26:59 +00:00
Raymond Hettinger 906f95e80b Move initialization of root link to __init__. 2009-03-23 04:42:18 +00:00
Raymond Hettinger f1e2df9780 Add more comments. Improve variable names.
Make links clearer by using a Link object
instead of a list.  Use proxy links to avoid
circular references.
2009-03-23 00:08:09 +00:00
Raymond Hettinger c8e81ef508 Fix typo 2009-03-19 23:22:25 +00:00
Raymond Hettinger e980d2d44b * Add implementation notes.
* Re-order methods so that those touching the underlying data
  structure come first and the derived methods come last.
2009-03-19 23:12:41 +00:00
Raymond Hettinger 2412299be9 * Add clearer comment to initialization code.
* Add optional argument to popitem() -- modeled
  after Anthon van der Neut's C version.
* Fix method markup in docs.
2009-03-19 19:59:58 +00:00
Raymond Hettinger 2124599eaa Improve implementation with better underlying data structure
for O(1) deletions.  Big-Oh performance now the same as regular
dictionaries.  Uses a doubly-linked list instead of a list/seq
to track insertion order.
2009-03-19 15:21:10 +00:00
Raymond Hettinger a61ae6922f Use mixin methods where possible. (2.7 only -- these don't all exist in 3.0) 2009-03-18 22:13:20 +00:00
Raymond Hettinger 131af6505a Backport 70140, 70141, 70143, and 70144.
Adds tests, switches from list to deque, fixes __reduce__
which was unnecessarily copying __keys.
2009-03-03 22:59:25 +00:00
Raymond Hettinger 0b15541ae2 Minor simplification. 2009-03-03 21:13:51 +00:00
Raymond Hettinger 9353ea2b85 Make the underlying data structure more private. 2009-03-03 20:53:51 +00:00
Raymond Hettinger 88a9164cdb Backport 70106: Add OrderedDict support to collections.namedtuple(). 2009-03-03 04:51:24 +00:00