From 9920f482546ffccd09ac5144d24bd9cc9cc40062 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 19 Jun 2008 10:41:47 +0000 Subject: [PATCH] Updated PEP 372 for Python 3 --- pep-0372.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/pep-0372.txt b/pep-0372.txt index 329fac779..b99920968 100644 --- a/pep-0372.txt +++ b/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 =====================