Quick update to the README file. For intros and books we now point to
[python/dscho.git] / Doc / lib / libuserdict.tex
blob8e47360ec520ea5b44b499394497149430a6078e
1 \section{\module{UserDict} ---
2 Class wrapper for dictionary objects}
4 \declaremodule{standard}{UserDict}
5 \modulesynopsis{Class wrapper for dictionary objects.}
7 This module defines a class that acts as a wrapper around
8 dictionary objects. It is a useful base class for
9 your own dictionary-like classes, which can inherit from
10 them and override existing methods or add new ones. In this way one
11 can add new behaviours to dictionaries.
13 The \module{UserDict} module defines the \class{UserDict} class:
15 \begin{classdesc}{UserDict}{\optional{intialdata}}
16 Return a class instance that simulates a dictionary. The instance's
17 contents are kept in a regular dictionary, which is accessible via the
18 \member{data} attribute of \class{UserDict} instances. If
19 \var{initialdata} is provided, \member{data} is initialized with its
20 contents; note that a reference to \var{initialdata} will not be kept,
21 allowing it be used used for other purposes.
22 \end{classdesc}
24 In addition to supporting the methods and operations of mappings (see
25 section \ref{typesmapping}), \class{UserDict} instances provide the
26 following attribute:
28 \begin{memberdesc}{data}
29 A real dictionary used to store the contents of the \class{UserDict}
30 class.
31 \end{memberdesc}
34 \section{\module{UserList} ---
35 Class wrapper for list objects}
37 \declaremodule{standard}{UserList}
38 \modulesynopsis{Class wrapper for list objects.}
41 This module defines a class that acts as a wrapper around
42 list objects. It is a useful base class for
43 your own list-like classes, which can inherit from
44 them and override existing methods or add new ones. In this way one
45 can add new behaviours to lists.
47 The \module{UserList} module defines the \class{UserList} class:
49 \begin{classdesc}{UserList}{\optional{list}}
50 Return a class instance that simulates a list. The instance's
51 contents are kept in a regular list, which is accessible via the
52 \member{data} attribute of \class{UserList} instances. The instance's
53 contents are initially set to a copy of \var{list}, defaulting to the
54 empty list \code{[]}. \var{list} can be either a regular Python list,
55 or an instance of \class{UserList} (or a subclass).
56 \end{classdesc}
58 In addition to supporting the methods and operations of mutable
59 sequences (see section \ref{typesseq}), \class{UserList} instances
60 provide the following attribute:
62 \begin{memberdesc}{data}
63 A real Python list object used to store the contents of the
64 \class{UserList} class.
65 \end{memberdesc}