27.07.18 16:29, Chris Angelico пише:
Ah, fair point. Interestingly, the same problem hits repr(dict(od)),
which I would have thought a reliable solution here. The simplest way
that I've found is:
dict(od.items())
{'b': 2, 'a': 1}
That seems very odd. Iterating over the OD produces its keys in the
correct order (b, a), but constructing a dict from it ignores
iteration order and just goes "oh hey, this is a dict, we can snag
that". Is that correct?
This looks like a bug to me. Opened https://bugs.python.org/issue34320 .
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/