O'Reilly logo
  • You Wang thinks this is interesting:

Python 3.1 introduced the collections.OrderedDict and the collections.Counter classes. OrderedDicts have the same API as normal dicts, although when iterated the items are always returned in insertion order (i.e., from first to last inserted), and the popitem() method always returns the most recently added (i.e., last) item. The Counter class is a dict subclass used to provide a fast and easy way of keeping various counts. Given an iterable or a mapping (such as a dictionary), a Counter instance can, for example, return a list of the unique elements or a list of the most common elements as (element, count) 2-tuples.

From

Cover of Programming in Python 3: A Complete Introduction to the Python Language, Second Edition

Note

Python facilities for efficient high level data structures.