Well, I was using a for … in  loop. Apparently, in Python 3.5, the order in which items are returned is not the same as the order in which they were inserted. From 3.6 onward, the retrieval order is the same as the insertion order…a trivial change really, but I’d assumed ordered behavior right from the start. Turns out I was wrong.