Carsten Haese wrote: > That could easily be fixed by making the sequence a "managed property" > whose setter raises a ValueError if you try to set it to something > that's not a permutation of what it was.
Ok, a managed attribute would be an option. You would allow people to do what they want with the sequence, and then fix the dictionary accordingly (if items were deleted from the sequence, they are deleted from the dictionary, it items were added which are not in the directory, a ValueError is raised etc.). But probably it is still better to hide the sequence and instead of letting people do list operations like sort() on the odict.sequence, let them do these operations on odict directly. >>d1[0] + d1[2] ==> OrderedDict( (1, 11), (3, 13) ) > What do you think you're doing here? Sorry, what I meant was d1[0:0] + d1[2:2] ==> OrderedDict( (1, 11), (3, 13) ) Ordered dictionaries could allow slicing and concatenation. -- Christoph -- http://mail.python.org/mailman/listinfo/python-list