(replying again, as the original somehow had a broken googlegroups.com address instead of the proper python.org one) On Tue, Dec 25, 2012 at 11:56 PM, Ram Rachum <ram.rachum@gmail.com> wrote:
When I have an OrderedDict, I want to be able to delete a slice of it. I want to be able to do:
del ordered_dict[:3]
To delete the first 3 items, like I would do in a list.
Is there any reason why this shouldn't be implemented?
Yes, because if you want to do that, you need a list, not an ordered dictionary. Don't try to lump every possible operation into one incoherent uber-type. If you need mutable list-like behaviour *and* mapping behaviour, you're better off with an ordinary mapping and a separate list of keys. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia