blob: 3bde7162672737eb932a1839eb3d59f9a1755c58 [file] [log] [blame]
Fred Drake1ce36041998-04-07 20:05:33 +00001\section{Standard Module \module{UserDict}}
Fred Drakefcda5601998-01-07 22:05:25 +00002\stmodindex{UserDict}
3\label{module-UserDict}
Fred Drakefcda5601998-01-07 22:05:25 +00004
Fred Drake1ce36041998-04-07 20:05:33 +00005This module defines a class that acts as a wrapper around
6dictionary objects. It is a useful base class for
7your own dictionary-like classes, which can inherit from
Guido van Rossum7f3b0421997-03-27 14:56:18 +00008them and override existing methods or add new ones. In this way one
Fred Drake1ce36041998-04-07 20:05:33 +00009can add new behaviours to dictionaries.
Guido van Rossum7f3b0421997-03-27 14:56:18 +000010
Fred Drake802a2021998-02-19 06:26:35 +000011The \module{UserDict} module defines the \class{UserDict} class:
Guido van Rossum7f3b0421997-03-27 14:56:18 +000012
Fred Drake802a2021998-02-19 06:26:35 +000013\begin{classdesc}{UserDict}{}
Guido van Rossum7f3b0421997-03-27 14:56:18 +000014Return a class instance that simulates a dictionary. The instance's
15contents are kept in a regular dictionary, which is accessible via the
Fred Drake802a2021998-02-19 06:26:35 +000016\member{data} attribute of \class{UserDict} instances.
17\end{classdesc}
Guido van Rossum7f3b0421997-03-27 14:56:18 +000018
Fred Drake1ce36041998-04-07 20:05:33 +000019\begin{memberdesc}{data}
20A real dictionary used to store the contents of the \class{UserDict}
21class.
22\end{memberdesc}
23
24
25\section{Standard Module \module{UserList}}
26\stmodindex{UserList}
27\label{module-UserList}
28
29This module defines a class that acts as a wrapper around
30list objects. It is a useful base class for
31your own list-like classes, which can inherit from
32them and override existing methods or add new ones. In this way one
33can add new behaviours to lists.
34
Fred Drake802a2021998-02-19 06:26:35 +000035The \module{UserList} module defines the \class{UserList} class:
Guido van Rossum7f3b0421997-03-27 14:56:18 +000036
Fred Drake802a2021998-02-19 06:26:35 +000037\begin{classdesc}{UserList}{\optional{list}}
Guido van Rossum7f3b0421997-03-27 14:56:18 +000038Return a class instance that simulates a list. The instance's
39contents are kept in a regular list, which is accessible via the
Fred Drake802a2021998-02-19 06:26:35 +000040\member{data} attribute of \class{UserList} instances. The instance's
Fred Drakefcda5601998-01-07 22:05:25 +000041contents are initially set to a copy of \var{list}, defaulting to the
Guido van Rossum7f3b0421997-03-27 14:56:18 +000042empty list \code{[]}. \var{list} can be either a regular Python list,
Fred Drake802a2021998-02-19 06:26:35 +000043or an instance of \class{UserList} (or a subclass).
44\end{classdesc}
Fred Drake1ce36041998-04-07 20:05:33 +000045
46\begin{memberdesc}{data}
47A real Python list object used to store the contents of the
48\class{UserList} class.
49\end{memberdesc}