"BJörn Lindqvist"
On 4/20/07, Terry Reedy
wrote: 2. Order in the sorting or collation sense, which I presume you mean. To reduce confusion, call this a sorted dictionary, as others have done.
Regardless, this has the problem that potential keys are not always comparable.
Current example:
[1, 1j].sort()
Traceback (most recent call last):
File "
This will become worse when most cross-type comparisons are disallowed in 3.0.
l = [(), "moo", 123, []] l.sort() l [123, [], 'moo', ()]
Py 3.0 will raise an exception here as these will all be incomparable.
If it is not a problem for lists it is not a problem for ordered dictionaries.
But it *is* currently a problem for lists that will become much more extensive in the future, so it *is* currently a problem for sorted dicts that will be much more of a problem in the future. Hence, sorted dicts will have to be restricted to one type or one group of truly comparable types. Terry Jan Reedy