1998-04-04 03:23:21 -04:00
|
|
|
\section{Standard Modules \module{UserDict} and \module{UserList}}
|
1998-02-11 19:00:08 -04:00
|
|
|
\nodename{UserDict and UserList}
|
1998-01-07 18:05:25 -04:00
|
|
|
\stmodindex{UserDict}
|
1998-02-11 19:00:08 -04:00
|
|
|
\stmodindex{UserList}
|
1998-01-07 18:05:25 -04:00
|
|
|
\label{module-UserDict}
|
|
|
|
\label{module-UserList}
|
|
|
|
|
1997-03-27 10:56:18 -04:00
|
|
|
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.
|
|
|
|
|
1998-02-13 02:58:54 -04:00
|
|
|
\setindexsubitem{(in module UserDict)}
|
1998-02-19 02:26:35 -04:00
|
|
|
The \module{UserDict} module defines the \class{UserDict} class:
|
1997-03-27 10:56:18 -04:00
|
|
|
|
1998-02-19 02:26:35 -04:00
|
|
|
\begin{classdesc}{UserDict}{}
|
1997-03-27 10:56:18 -04:00
|
|
|
Return a class instance that simulates a dictionary. The instance's
|
|
|
|
contents are kept in a regular dictionary, which is accessible via the
|
1998-02-19 02:26:35 -04:00
|
|
|
\member{data} attribute of \class{UserDict} instances.
|
|
|
|
\end{classdesc}
|
1997-03-27 10:56:18 -04:00
|
|
|
|
1998-02-13 02:58:54 -04:00
|
|
|
\setindexsubitem{(in module UserList)}
|
1998-02-19 02:26:35 -04:00
|
|
|
The \module{UserList} module defines the \class{UserList} class:
|
1997-03-27 10:56:18 -04:00
|
|
|
|
1998-02-19 02:26:35 -04:00
|
|
|
\begin{classdesc}{UserList}{\optional{list}}
|
1997-03-27 10:56:18 -04:00
|
|
|
Return a class instance that simulates a list. The instance's
|
|
|
|
contents are kept in a regular list, which is accessible via the
|
1998-02-19 02:26:35 -04:00
|
|
|
\member{data} attribute of \class{UserList} instances. The instance's
|
1998-01-07 18:05:25 -04:00
|
|
|
contents are initially set to a copy of \var{list}, defaulting to the
|
1997-03-27 10:56:18 -04:00
|
|
|
empty list \code{[]}. \var{list} can be either a regular Python list,
|
1998-02-19 02:26:35 -04:00
|
|
|
or an instance of \class{UserList} (or a subclass).
|
|
|
|
\end{classdesc}
|