blob: ce86ad26e08e836fdbe15069c2d405fc22220bf9 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{UserDict} ---
Fred Drake6bf37de1999-06-29 18:13:37 +00002 Class wrapper for dictionary objects}
3
Fred Drakeb91e9341998-07-23 17:59:49 +00004\declaremodule{standard}{UserDict}
Fred Drakeb91e9341998-07-23 17:59:49 +00005\modulesynopsis{Class wrapper for dictionary objects.}
6
Fred Drake1ce36041998-04-07 20:05:33 +00007This module defines a class that acts as a wrapper around
8dictionary objects. It is a useful base class for
9your own dictionary-like classes, which can inherit from
Guido van Rossum7f3b0421997-03-27 14:56:18 +000010them and override existing methods or add new ones. In this way one
Fred Drake1ce36041998-04-07 20:05:33 +000011can add new behaviours to dictionaries.
Guido van Rossum7f3b0421997-03-27 14:56:18 +000012
Fred Drake802a2021998-02-19 06:26:35 +000013The \module{UserDict} module defines the \class{UserDict} class:
Guido van Rossum7f3b0421997-03-27 14:56:18 +000014
Fred Drake802a2021998-02-19 06:26:35 +000015\begin{classdesc}{UserDict}{}
Guido van Rossum7f3b0421997-03-27 14:56:18 +000016Return a class instance that simulates a dictionary. The instance's
17contents are kept in a regular dictionary, which is accessible via the
Fred Drake802a2021998-02-19 06:26:35 +000018\member{data} attribute of \class{UserDict} instances.
19\end{classdesc}
Guido van Rossum7f3b0421997-03-27 14:56:18 +000020
Fred Drake6bf37de1999-06-29 18:13:37 +000021In addition to supporting the methods and operations of mappings (see
22section \ref{typesmapping}), \class{UserDict} instances provide the
23following attribute:
24
Fred Drake1ce36041998-04-07 20:05:33 +000025\begin{memberdesc}{data}
26A real dictionary used to store the contents of the \class{UserDict}
27class.
28\end{memberdesc}
29
30
Fred Drake295da241998-08-10 19:42:37 +000031\section{\module{UserList} ---
Fred Drake6bf37de1999-06-29 18:13:37 +000032 Class wrapper for list objects}
Fred Drakeb91e9341998-07-23 17:59:49 +000033
Fred Drake6bf37de1999-06-29 18:13:37 +000034\declaremodule{standard}{UserList}
Fred Drakeb91e9341998-07-23 17:59:49 +000035\modulesynopsis{Class wrapper for list objects.}
36
Fred Drake1ce36041998-04-07 20:05:33 +000037
38This module defines a class that acts as a wrapper around
39list objects. It is a useful base class for
40your own list-like classes, which can inherit from
41them and override existing methods or add new ones. In this way one
42can add new behaviours to lists.
43
Fred Drake802a2021998-02-19 06:26:35 +000044The \module{UserList} module defines the \class{UserList} class:
Guido van Rossum7f3b0421997-03-27 14:56:18 +000045
Fred Drake802a2021998-02-19 06:26:35 +000046\begin{classdesc}{UserList}{\optional{list}}
Guido van Rossum7f3b0421997-03-27 14:56:18 +000047Return a class instance that simulates a list. The instance's
48contents are kept in a regular list, which is accessible via the
Fred Drake802a2021998-02-19 06:26:35 +000049\member{data} attribute of \class{UserList} instances. The instance's
Fred Drakefcda5601998-01-07 22:05:25 +000050contents are initially set to a copy of \var{list}, defaulting to the
Guido van Rossum7f3b0421997-03-27 14:56:18 +000051empty list \code{[]}. \var{list} can be either a regular Python list,
Fred Drake802a2021998-02-19 06:26:35 +000052or an instance of \class{UserList} (or a subclass).
53\end{classdesc}
Fred Drake1ce36041998-04-07 20:05:33 +000054
Fred Drake6bf37de1999-06-29 18:13:37 +000055In addition to supporting the methods and operations of mutable
56sequences (see section \ref{typesseq}), \class{UserList} instances
57provide the following attribute:
58
Fred Drake1ce36041998-04-07 20:05:33 +000059\begin{memberdesc}{data}
60A real Python list object used to store the contents of the
61\class{UserList} class.
62\end{memberdesc}