I've completed the doctests for odict.py, and reworked the whole file.
It's unbelievable how long it takes to fix all the corner cases, and how
much tests help. :-) I simplified and fixed most of the code.
I also restricted a couple of things.
Now an OrderedDict can only be init'ed from a sequence of 2-item sequences,
like a plain dict:
d = OrderedDict((
(1, 1),
(2, 2),
(3, 3),
))
or else it can be created empty, and the have items set aftewards:
d = OrderedDict()
d[1] = 1
d[2] = 2
d[3] = 3
Neither a plain dict nor keyword args can be passed in anymore, because
there's no way to determine the order of items, with them.
The same holds for updates and comparisons: they're only meaningful between
OrderedDicts.
--
Nicola Larosa - ni...@te...
Does it seem like I'm looking for an answer
To a question I can't ask
-- Norah Jones, Nightingale, Come Away with Me, 2001
|