On Thu, Jul 9, 2020, at 13:26, Stestagg wrote:
Obviously, python is a general-purpose, turing complete language, so each of these options can be written in other ways. But it would be nice if the simple, readable versions also worked :D
The idea that there are future, unspecified changes to dicts() that may or may not be hampered by allowing indexing sounds like FUD to me, unless there are concrete references?
Does the current implementation support indexing? It is certainly possible in principle to preserve ordering without indexing, for example if a linked list is used to support the ordering, or if items are stored in an array where deleted items leave holes permanently until the dict is resized.
I don't know how dict works, but I am not sure how you would support indexing while also allowing deletion to be O(1). A specific random key function would be narrower in scope than this, and for anyone who wants full sequence support, perhaps that could be added to OrderedDict.