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