Fred Drake | 1ce3604 | 1998-04-07 20:05:33 +0000 | [diff] [blame] | 1 | \section{Standard Module \module{UserDict}} |
Fred Drake | fcda560 | 1998-01-07 22:05:25 +0000 | [diff] [blame] | 2 | \stmodindex{UserDict} |
| 3 | \label{module-UserDict} |
Fred Drake | fcda560 | 1998-01-07 22:05:25 +0000 | [diff] [blame] | 4 | |
Fred Drake | 1ce3604 | 1998-04-07 20:05:33 +0000 | [diff] [blame] | 5 | This module defines a class that acts as a wrapper around |
| 6 | dictionary objects. It is a useful base class for |
| 7 | your own dictionary-like classes, which can inherit from |
Guido van Rossum | 7f3b042 | 1997-03-27 14:56:18 +0000 | [diff] [blame] | 8 | them and override existing methods or add new ones. In this way one |
Fred Drake | 1ce3604 | 1998-04-07 20:05:33 +0000 | [diff] [blame] | 9 | can add new behaviours to dictionaries. |
Guido van Rossum | 7f3b042 | 1997-03-27 14:56:18 +0000 | [diff] [blame] | 10 | |
Fred Drake | 802a202 | 1998-02-19 06:26:35 +0000 | [diff] [blame] | 11 | The \module{UserDict} module defines the \class{UserDict} class: |
Guido van Rossum | 7f3b042 | 1997-03-27 14:56:18 +0000 | [diff] [blame] | 12 | |
Fred Drake | 802a202 | 1998-02-19 06:26:35 +0000 | [diff] [blame] | 13 | \begin{classdesc}{UserDict}{} |
Guido van Rossum | 7f3b042 | 1997-03-27 14:56:18 +0000 | [diff] [blame] | 14 | Return a class instance that simulates a dictionary. The instance's |
| 15 | contents are kept in a regular dictionary, which is accessible via the |
Fred Drake | 802a202 | 1998-02-19 06:26:35 +0000 | [diff] [blame] | 16 | \member{data} attribute of \class{UserDict} instances. |
| 17 | \end{classdesc} |
Guido van Rossum | 7f3b042 | 1997-03-27 14:56:18 +0000 | [diff] [blame] | 18 | |
Fred Drake | 1ce3604 | 1998-04-07 20:05:33 +0000 | [diff] [blame] | 19 | \begin{memberdesc}{data} |
| 20 | A real dictionary used to store the contents of the \class{UserDict} |
| 21 | class. |
| 22 | \end{memberdesc} |
| 23 | |
| 24 | |
| 25 | \section{Standard Module \module{UserList}} |
| 26 | \stmodindex{UserList} |
| 27 | \label{module-UserList} |
| 28 | |
| 29 | This module defines a class that acts as a wrapper around |
| 30 | list objects. It is a useful base class for |
| 31 | your own list-like classes, which can inherit from |
| 32 | them and override existing methods or add new ones. In this way one |
| 33 | can add new behaviours to lists. |
| 34 | |
Fred Drake | 802a202 | 1998-02-19 06:26:35 +0000 | [diff] [blame] | 35 | The \module{UserList} module defines the \class{UserList} class: |
Guido van Rossum | 7f3b042 | 1997-03-27 14:56:18 +0000 | [diff] [blame] | 36 | |
Fred Drake | 802a202 | 1998-02-19 06:26:35 +0000 | [diff] [blame] | 37 | \begin{classdesc}{UserList}{\optional{list}} |
Guido van Rossum | 7f3b042 | 1997-03-27 14:56:18 +0000 | [diff] [blame] | 38 | Return a class instance that simulates a list. The instance's |
| 39 | contents are kept in a regular list, which is accessible via the |
Fred Drake | 802a202 | 1998-02-19 06:26:35 +0000 | [diff] [blame] | 40 | \member{data} attribute of \class{UserList} instances. The instance's |
Fred Drake | fcda560 | 1998-01-07 22:05:25 +0000 | [diff] [blame] | 41 | contents are initially set to a copy of \var{list}, defaulting to the |
Guido van Rossum | 7f3b042 | 1997-03-27 14:56:18 +0000 | [diff] [blame] | 42 | empty list \code{[]}. \var{list} can be either a regular Python list, |
Fred Drake | 802a202 | 1998-02-19 06:26:35 +0000 | [diff] [blame] | 43 | or an instance of \class{UserList} (or a subclass). |
| 44 | \end{classdesc} |
Fred Drake | 1ce3604 | 1998-04-07 20:05:33 +0000 | [diff] [blame] | 45 | |
| 46 | \begin{memberdesc}{data} |
| 47 | A real Python list object used to store the contents of the |
| 48 | \class{UserList} class. |
| 49 | \end{memberdesc} |