> Another except from the PEP: "A version written in C could use a > linked list. The code would be more complex than the other two > approaches but it would conserve space and would keep the same big-oh > performance as regular dictionaries. It is the fastest and most space > efficient."
The trade-off (final quote from the PEP): Does OrderedDict support indexing, slicing, and whatnot? As a matter of fact, OrderedDict does not implement the Sequence interface. Rather, it is a MutableMapping that remembers the order of key insertion. The only sequence-like addition is support for reversed. An further advantage of not allowing indexing is that it leaves open the possibility of a fast C implementation using linked lists. Does OrderedDict support alternate sort orders such as alphabetical? No. Those wanting different sort orders really need to be using another technique. The OrderedDict is all about recording insertion order. If any other order is of interest, then another structure (like an in-memory dbm) is likely a better fit. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org