collections package provides several specialized, flexible collection types that are both high-performance and provide alternatives to the general collection types of
set. The module also defines abstract base classes describing different types of collection functionality (such as
There are three other types available in the collections module, namely:
They each act as a wrapper around the tied object, e.g., UserDict acts as a wrapper around a dict object. In each case, the class simulates its named type. The instance's contents are kept in a regular type object, which is accessible via the data attribute of the wrapper instance. In each of these three cases, the need for these types has been partially supplanted by the ability to subclass directly from the basic type; however, the wrapper class can be easier to work with because the underlying type is accessible as an attribute.