[Python-ideas] Re: Access (ordered) dict by index; insert slice
I believe I described my case poorly, the process to get from one state (key) to the next is an external (slow) process; the value stored is not the next state but a value calculated while advancing the state. This dict serves as a way to quickly skip steps of the external process when it has repeated itself, and thus calculating the next key would be exorbitantly slower than iterating through the whole dict. In any case as a poster pointed out above, my example is not as compelling in terms of a speedup as I thought, the dict key iteration is not very long in practice compared to other operations I need to do. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/GZIIFVMRQDQLPNCZAYM4HHZ3HAHGXD2H/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-ideas] Re: Access (ordered) dict by index; insert slice
Having gotten to an implementation, you are correct, the dict iteration does not take the lion's share, or at least there are several other steps in my application which dwarf the dict traversal operations in any case. I don't think I in practice have a compelling case here, so all I'm left with is the vagueism that there must exist use cases where this would be the bottleneck, which is admittedly a cop-out. I mostly feel that the new dict internals are so convenient in enabling this that it would be a shame not to be able to have this performance improvement for the obscure case (which I can't think of) where creating a list copy would be undesirable for some reason other than the (as you point out) small memory increase. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/PRC2EGRSN6JJME4WBNA4PLB2YFXKNO7K/ Code of Conduct: http://python.org/psf/codeofconduct/