orderedstuf constructor doesn't respect item ordering

Issue #6 new
Jonathan Eunice created an issue

I understand when a normal unordered mapping randomly orders its keys. That's part of its contract--keys are not going to be ordered. I don't understand it so much with an ordered mapping:

>>> from stuf import orderedstuf
>>> orderedstuf([('a', 1), ('b', 2), ('c', 3), ('d', 4)])
orderedstuf(a=1, c=3, b=2, d=4)

Shouldn't I be able to construct an orderedstuf without it reordering the keys? I understand that if I asked for orderedstuf(a=1, b=2, c=3, d=4) that would not give me back an ordered mapping, because Python argument passing beneath the covers would put the parameters into a jumbled dict before passing off to orderedstuf. But if I go to the trouble of ordering the keys in a list of key-value pairs, why is orderedstuf not respecting that? OrderedDict does:

>>> OrderedDict([('a', 1), ('b', 2), ('c', 3), ('d', 4)])
OrderedDict([('a', 1), ('b', 2), ('c', 3), ('d', 4)])

Comments (0)

  1. Log in to comment