On Wed, Jan 20, 2016 at 01:33:17PM +0000, Albert-Jan Roskam wrote: > Hi, > > Like the subject says: Why is an OrderedDict not sliceable? (From the > collections library). Was that an intentional omission, or a mistake? > [1]
Because slicing a dict makes no sense. A dict is a mapping, not a sequence. d = OrderedDict() d["cow"] = "a" d["fox"] = "b" d["ape"] = "c" d["dog"] = "d" d["bee"] = "e" I can do a dict lookup on a key: d["cow"] What would a slice even mean? d[1:4] but 1, 2, 3 are not keys of the dict. -- Steve _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor