Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d319ad5c
Commit
d319ad5c
authored
Jul 18, 2010
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nest method and attribute doc
parent
0b9fb808
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
Doc/library/collections.rst
Doc/library/collections.rst
+16
-15
No files found.
Doc/library/collections.rst
View file @
d319ad5c
...
...
@@ -551,7 +551,7 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
:class:`defaultdict` objects support the following method in addition to the
standard :class:`dict` operations:
.. method::
defaultdict.
__missing__(key)
.. method:: __missing__(key)
If the :attr:`default_factory` attribute is ``None``, this raises a
:exc:`KeyError` exception with the *key* as argument.
...
...
@@ -571,7 +571,7 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
:class:`defaultdict` objects support the following instance variable:
.. attribute:: default
dict.default
_factory
.. attribute:: default_factory
This attribute is used by the :meth:`__missing__` method; it is
initialized from the first argument to the constructor, if present, or to
...
...
@@ -891,11 +891,11 @@ the items are returned in the order their keys were first added.
.. versionadded:: 3.1
.. method:: OrderedDict.
popitem(last=True)
.. method::
popitem(last=True)
The :meth:`popitem` method for ordered dictionaries returns and removes
a (key, value) pair. The pairs are returned in LIFO order if *last* is
true
or FIFO order if false.
The :meth:`popitem` method for ordered dictionaries returns and removes a
(key, value) pair. The pairs are returned in LIFO order if *last* is true
or FIFO order if false.
In addition to the usual mapping methods, ordered dictionaries also support
reverse iteration using :func:`reversed`.
...
...
@@ -956,12 +956,13 @@ attribute.
initialized with its contents; note that a reference to *initialdata* will not
be kept, allowing it be used for other purposes.
In addition to supporting the methods and operations of mappings,
:class:`UserDict` instances provide the following attribute:
In addition to supporting the methods and operations of mappings,
:class:`UserDict` instances provide the following attribute:
.. attribute:: UserDict.
data
.. attribute::
data
A real dictionary used to store the contents of the :class:`UserDict` class.
A real dictionary used to store the contents of the :class:`UserDict`
class.
...
...
@@ -985,13 +986,13 @@ to work with because the underlying list is accessible as an attribute.
defaulting to the empty list ``[]``. *list* can be any iterable, for
example a real Python list or a :class:`UserList` object.
In addition to supporting the methods and operations of mutable sequences,
:class:`UserList` instances provide the following attribute:
In addition to supporting the methods and operations of mutable sequences,
:class:`UserList` instances provide the following attribute:
.. attribute:: UserList.
data
.. attribute::
data
A real :class:`list` object used to store the contents of the
:class:`UserList` class.
A real :class:`list` object used to store the contents of the
:class:`UserList` class.
**Subclassing requirements:** Subclasses of :class:`UserList` are expect to
offer a constructor which can be called with either no arguments or one
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment