
Chris Angelico writes:
I would pick repeatedly from the same dictionary but it might be mutated in between. So the list would have to be reconstructed fresh every time.
OK, that moves me a couple million Planck lengths away from -1 nm. :-) I guess in that case if I cared about performance of both dict and sequence access, I would use a derived type with the actual data store being a list, and a dict storing the index (this was suggested to the OP, IIRC). If I really, *really*, REALLY cared about performance I'd write an accelerated module (eg, in C for CPython)[1], and take advantage of special characteristics of my application. WDYT? Footnotes: [1] Okay, I've done that for XEmacs, though not yet for Python. So that's probably not something I could recommend to typical Pythonistas.