3.4 UserList -- Class wrapper for list objects

This module defines a class that acts as a wrapper around list objects. It is a useful base class for your own 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 lists.

The UserList module defines the UserList class:

UserList ([list])
Return a class instance that simulates a list. The instance's contents are kept in a regular list, which is accessible via the data attribute of UserList instances. The instance's contents are initially set to a copy of list, defaulting to the empty list []. list can be either a regular Python list, or an instance of UserList (or a subclass).

In addition to supporting the methods and operations of mutable sequences (see section 2.1.5), UserList instances provide the following attribute:

data
A real Python list object used to store the contents of the UserList class.


Send comments on this document to python-docs@python.org.