I have a piece of code that essentially reimplements OrderedDict. I have been wondering why the key ordered is not preserved correctly (tests fail).

c = Container(a=1,b=2,c=3,d=4)
self.assertEqual(c.keys(), ["a","b","c","d"])
self.assertEqual(c.values(), [1,2,3,4])
self.assertEqual(c.items(), [("a",1),("b",2),("c",3),("d",4)])

Then I looked at collections.OrderedDict ctor docstring and it says "Initialize an ordered dictionary.  The signature is the same as regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary."

I expected the **kw to reproduce the same order as actual keyword arguments. The only right way to solve it, as it seems to me, would be to make **kw an OrderedDict.

Arkadiusz Bulski