6 Comments
User's avatar
⭠ Return to thread
Ash Roberts's avatar

I have a project I'm working on where I don't just need insertion order of the keys, I also need the index position of the keys. At first I thought that was something that OrderedDict was going to give me, but it doesn't have any methods for anything like that, so now I'm building my own dictionary class IndexedDict, that has an internal list to track the key position.

Stephen Gruppetta's avatar

You could presumably build upon `OrderedDict` and use `list(self.keys())` to get a sequence of keys. Is that the route you’re taking?