PEP 455: add BDFL-Delegate and fix some minor typos.
This commit is contained in:
parent
5efee1848e
commit
1e063f7102
12
pep-0455.txt
12
pep-0455.txt
|
@ -3,6 +3,7 @@ Title: Adding a key-transforming dictionary to collections
|
||||||
Version: $Revision$
|
Version: $Revision$
|
||||||
Last-Modified: $Date$
|
Last-Modified: $Date$
|
||||||
Author: Antoine Pitrou <solipsis@pitrou.net>
|
Author: Antoine Pitrou <solipsis@pitrou.net>
|
||||||
|
BDFL-Delegate: Raymond Hettinger
|
||||||
Status: Draft
|
Status: Draft
|
||||||
Type: Standards Track
|
Type: Standards Track
|
||||||
Content-Type: text/x-rst
|
Content-Type: text/x-rst
|
||||||
|
@ -40,15 +41,15 @@ function is applied to keys when looking them up: that function being
|
||||||
``str.lower`` or ``str.casefold`` in the former example and the built-in
|
``str.lower`` or ``str.casefold`` in the former example and the built-in
|
||||||
``id`` function in the latter.
|
``id`` function in the latter.
|
||||||
|
|
||||||
(it could be said that the pattern *projects* keys from the user-visible
|
(It could be said that the pattern *projects* keys from the user-visible
|
||||||
set onto the internal lookup set)
|
set onto the internal lookup set.)
|
||||||
|
|
||||||
|
|
||||||
Semantics
|
Semantics
|
||||||
=========
|
=========
|
||||||
|
|
||||||
TransformDict is a ``MutableMapping`` implementation: it faithfully
|
TransformDict is a ``MutableMapping`` implementation: it faithfully
|
||||||
implements the well-known API of mutable mappings, as ``dict`` itself
|
implements the well-known API of mutable mappings, like ``dict`` itself
|
||||||
and other dict-like classes in the standard library. Therefore, this PEP
|
and other dict-like classes in the standard library. Therefore, this PEP
|
||||||
won't rehash the semantics of most TransformDict methods.
|
won't rehash the semantics of most TransformDict methods.
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@ function returns a hashable one::
|
||||||
Constructor
|
Constructor
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
As shown in the example aboves, creating a TransformDict requires passing
|
As shown in the examples above, creating a TransformDict requires passing
|
||||||
the key transformation function as the first argument (much like creating
|
the key transformation function as the first argument (much like creating
|
||||||
a ``defaultdict`` requires passing the factory function as first argument).
|
a ``defaultdict`` requires passing the factory function as first argument).
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ together with the corresponding value::
|
||||||
File "<stdin>", line 1, in <module>
|
File "<stdin>", line 1, in <module>
|
||||||
KeyError: 'bar'
|
KeyError: 'bar'
|
||||||
|
|
||||||
The method name ``getitem()`` mirrors the standard ``popitem()`` method
|
The method name ``getitem()`` follows the standard ``popitem()`` method
|
||||||
on mutable mappings.
|
on mutable mappings.
|
||||||
|
|
||||||
Getting the transformation function
|
Getting the transformation function
|
||||||
|
@ -263,6 +264,7 @@ Copyright
|
||||||
This document has been placed in the public domain.
|
This document has been placed in the public domain.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
..
|
..
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: indented-text
|
mode: indented-text
|
||||||
|
|
Loading…
Reference in New Issue