diff options
Diffstat (limited to 'Doc/library/userdict.rst')
-rw-r--r-- | Doc/library/userdict.rst | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/Doc/library/userdict.rst b/Doc/library/userdict.rst index 820a743..1475197 100644 --- a/Doc/library/userdict.rst +++ b/Doc/library/userdict.rst @@ -1,56 +1,4 @@ -:mod:`UserDict` --- Class wrapper for dictionary objects -======================================================== - -.. module:: UserDict - :synopsis: Class wrapper for dictionary objects. - - -The module defines a mixin, :class:`DictMixin`, defining all dictionary methods -for classes that already have a minimum mapping interface. This greatly -simplifies writing classes that need to be substitutable for dictionaries (such -as the shelve module). - -This also module defines a class, :class:`UserDict`, that acts as a wrapper -around dictionary objects. The need for this class has been largely supplanted -by the ability to subclass directly from :class:`dict` (a feature that became -available starting with Python version 2.2). Prior to the introduction of -:class:`dict`, the :class:`UserDict` class was used to create dictionary-like -sub-classes that obtained new behaviors by overriding existing methods or adding -new ones. - -The :mod:`UserDict` module defines the :class:`UserDict` class and -:class:`DictMixin`: - - -.. class:: UserDict([initialdata]) - - Class that simulates a dictionary. The instance's contents are kept in a - regular dictionary, which is accessible via the :attr:`data` attribute of - :class:`UserDict` instances. If *initialdata* is provided, :attr:`data` is - initialized with its contents; note that a reference to *initialdata* will not - be kept, allowing it be used for other purposes. - - .. note:: - - For backward compatibility, instances of :class:`UserDict` are not - iterable. - - -.. class:: IterableUserDict([initialdata]) - - Subclass of :class:`UserDict` that supports direct iteration (e.g. ``for key in - myDict``). - -In addition to supporting the methods and operations of mappings (see section -:ref:`typesmapping`), :class:`UserDict` and :class:`IterableUserDict` instances -provide the following attribute: - - -.. attribute:: IterableUserDict.data - - A real dictionary used to store the contents of the :class:`UserDict` class. - :mod:`UserList` --- Class wrapper for list objects ================================================== |