UserDict
and UserList
Each of these modules defines a class that acts as a wrapper around either dictionary or list objects. They're useful base classes for your own dictionary-like or list-like classes, which can inherit from them and override existing methods or add new ones. In this way one can add new behaviours to dictionaries or lists.
The UserDict
module defines the UserDict
class:
data
attribute of UserDict
instances.
The UserList
module defines the UserList
class:
data
attribute of UserList
instances. The instance's
contents are initially set to c copy of list, defaulting to the
empty list []
. list can be either a regular Python list,
or an instance of UserList
(or a subclass).