Updated PEP 372 for Python 3
This commit is contained in:
parent
3d4c067d54
commit
9920f48254
31
pep-0372.txt
31
pep-0372.txt
|
@ -151,6 +151,37 @@ New methods not available on dict:
|
|||
kicks in.
|
||||
|
||||
|
||||
Python 3 Version
|
||||
================
|
||||
|
||||
The Python 3 version of the ``odict`` returns dictionary views rather
|
||||
than lists for ``odict.keys()``, ``odict.values()`` and ``odict.items()``.
|
||||
The keys-view is equivalent to a regular key view but supports the following
|
||||
extra or changed operations:
|
||||
|
||||
``odict_keys.__getitem__(index)``
|
||||
|
||||
Returns the key for an index. This is equivalent to ``odict.byindex(index) ``
|
||||
|
||||
``odict_keys.index(key)``
|
||||
|
||||
Returns the index for a key. This exists for compatibility with the
|
||||
`Sequence` abstract base class and is equivalent to ``odict.index(key)``.
|
||||
|
||||
``odict_keys.__iter__()``
|
||||
|
||||
Has the same semantics as ``odict.__iter__()``
|
||||
|
||||
``odict_keys.__reversed__()``
|
||||
|
||||
Has the same semantics as ``odict.__reversed__()``
|
||||
|
||||
``odict_keys.__cmp__()`` / ``odict_keys.__eq__()`` / ``odict_keys.__ne__()``
|
||||
|
||||
Same semantics as the equivalent ``odict`` operation. Eg: when compared
|
||||
to another odict keys-view the ordering is taken into account.
|
||||
|
||||
|
||||
Questions and Answers
|
||||
=====================
|
||||
|
||||
|
|
Loading…
Reference in New Issue