blob: e47babd9b138e0657771e7d92d1ffc1c0d32fdb6 [file] [log] [blame]
Guido van Rossum7f3b0421997-03-27 14:56:18 +00001\section{Standard Modules \sectcode{UserDict} and \sectcode{UserList}}
2Each of these modules defines a class that acts as a wrapper around
3either dictionary or list objects. They're useful base classes for
4your own dictionary-like or list-like classes, which can inherit from
5them and override existing methods or add new ones. In this way one
6can add new behaviours to dictionaries or lists.
7
8\renewcommand{\indexsubitem}{(in module UserDict)}
9The \code{UserDict} module defines the \code{UserDict} class:
10
11\begin{funcdesc}{UserDict}{}
12Return a class instance that simulates a dictionary. The instance's
13contents are kept in a regular dictionary, which is accessible via the
14\code{data} attribute of \code{UserDict} instances.
15\end{funcdesc}
16
17\renewcommand{\indexsubitem}{(in module UserList)}
18The \code{UserList} module defines the \code{UserList} class:
19
20\begin{funcdesc}{UserList}{\optional{list}}
21Return a class instance that simulates a list. The instance's
22contents are kept in a regular list, which is accessible via the
23\code{data} attribute of \code{UserList} instances. The instance's
24contents are initially set to c copy of \var{list}, defaulting to the
25empty list \code{[]}. \var{list} can be either a regular Python list,
26or an instance of \code{UserList} (or a subclass).
27\end{funcdesc}