Ordered Dictionary 0.2.2

1 view
Skip to first unread message

fuzz...@voidspace.org.uk

unread,
Nov 28, 2006, 4:58:53 PM11/28/06
to pytho...@googlegroups.com

Ordered Dictionary 0.2.2

emoticon:restart After a break of almost a year there has been an update to odict the Ordered Dictionary.

The latest version is 0.2.2, with changes implemented by Nicola Larosa.

Despite over 700 downloads since May (plus 1300 as part of pythonutils) there have been no bug reports, only improvements [1]. Smile

odict is a pure Python implementation of an ordered dictionary. It keeps keys in insertion order and allows you to change the order. Methods (including iteration) that would return members in an arbitrary order are now ordered.

There is also the SequenceOrderedDict that behaves like a sequence as well as a dictionary. It allows slicing and the keys, values and items methods are special sequence objects (which are also callable and so behave as methods too).

Removed the TODO and CHANGELOG sections in the tail docstring (they are in the docs anyway).

Disabled warnings during tests.

Explicitly disabled tests execution on Python v.2.2 . In addition to the slicing tests, other ones are failing.

Removed code duplication between the __init__ and the update methods.

Misc. cleanup.

Also, based on code from Tim Wegener:

  • added the rename method;
  • removed a has_key usage in the __setitem__ method.

Moved the ISSUES chapter from code's tail docstring to here.

Moved up the Creating an Ordered Dictionary chapter.

Added prompts to the code examples and removed the superfluous print statements (sometimes they were there, sometimes they were not).

Misc. cleanup.

[1]So either no-one is using it, or it's really good...

Posted by Fuzzyman on 2006-11-28 21:40:52.
Categories: Python, Projects
Visit the Voidspace Techie Blog to read this entry and more.

Reply all
Reply to author
Forward
0 new messages