Python 3.1 introduced the
collections.OrderedDict and the
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.
- 5. Modules
- from Programming in Python 3: A Complete Introduction to the Python Language, Second Edition
- Publisher: Addison-Wesley Professional
- Released: November 2009
Python facilities for efficient high level data structures.
Share this highlighthttp://www.safaribooksonline.com/a/programming-in-python/9084076/