[Python-checkins] r64403 - peps/trunk/pep-0372.txt
armin.ronacher
python-checkins at python.org
Thu Jun 19 12:41:47 CEST 2008
Author: armin.ronacher
Date: Thu Jun 19 12:41:47 2008
New Revision: 64403
Log:
Updated PEP 372 for Python 3
Modified:
peps/trunk/pep-0372.txt
Modified: peps/trunk/pep-0372.txt
==============================================================================
--- peps/trunk/pep-0372.txt (original)
+++ peps/trunk/pep-0372.txt Thu Jun 19 12:41:47 2008
@@ -151,6 +151,37 @@
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
=====================
More information about the Python-checkins
mailing list