[Tutor] Why is an OrderedDict not sliceable?
Albert-Jan Roskam
sjeik_appie at hotmail.com
Wed Jan 20 08:33:17 EST 2016
Hi,
Like the subject says: Why is an OrderedDict not sliceable? (From the collections library). Was that an intentional omission, or a mistake? [1]
Background: I do not use OrderedDict very often, but I thought I could use it to look up street and city names using postcodes ([0-9]{4} [a-z]{2} format). I needed it to be ordered because I also wanted to be able to use bisect, which is needed when the postcode letters are missing. In short: a fast dict lookup for complete postcodes and less fast bisect lookup for in complete postcodes.
[1] http://stackoverflow.com/questions/30975339/slicing-a-python-ordereddict
Thanks!
Albert-Jan
More information about the Tutor
mailing list