Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From what I recall, Python (2.6) dictionaries do not necessarily preserve the order of items in the underlying structure. Eg. if "x = {1:1, 2:2, -1:5}", then x.items() will not necessaryily return "[(1, 1), (2, 2), (-1, 5)]"

However, in Python 2.7+ ordered dictionaries in the collections library do preserve order. Perhaps this achieves the desired behavior?



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: