[Python-checkins] peps: Address Serhiy's comments
antoine.pitrou
python-checkins at python.org
Fri Sep 13 21:40:43 CEST 2013
http://hg.python.org/peps/rev/4c4adcc0e3b2
changeset: 5108:4c4adcc0e3b2
user: Antoine Pitrou <solipsis at pitrou.net>
date: Fri Sep 13 21:40:34 2013 +0200
summary:
Address Serhiy's comments
files:
pep-0455.txt | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/pep-0455.txt b/pep-0455.txt
--- a/pep-0455.txt
+++ b/pep-0455.txt
@@ -35,11 +35,11 @@
Both are instances of a more general pattern, where a given transformation
function is applied to keys when looking them up: that function being
-``str.lower`` in the former example and the built-in ``id`` function in
-the latter.
+``str.lower`` or ``str.casefold`` in the former example and the built-in
+``id`` function in the latter.
-(it can be said that the pattern *projects* keys from the user-visible
-set onto the internal lookup set, hence this PEP's title)
+(it could be said that the pattern *projects* keys from the user-visible
+set onto the internal lookup set)
Semantics
@@ -53,7 +53,7 @@
The transformation function needn't be bijective, it can be strictly
surjective as in the case-insensitive example::
- >>> d = TransformDict(str.lower)
+ >>> d = TransformDict(str.casefold)
>>> d['SomeKey'] = 5
>>> d['somekey']
5
@@ -62,7 +62,7 @@
TransformDict retains the first key used when creating an entry::
- >>> d = TransformDict(str.lower)
+ >>> d = TransformDict(str.casefold)
>>> d['SomeKey'] = 1
>>> d['somekey'] = 2
>>> list(d.items())
@@ -89,7 +89,7 @@
optional arguments are the same as in the ``dict`` and ``defaultdict``
constructors::
- >>> d = TransformDict(str.lower, [('Foo': 1)], Bar=2)
+ >>> d = TransformDict(str.casefold, [('Foo', 1)], Bar=2)
>>> sorted(d.items())
[('Bar', 2), ('Foo', 1)]
@@ -175,8 +175,9 @@
* https://mail.python.org/pipermail/python-ideas/2010-May/007235.html
* http://www.gossamer-threads.com/lists/python/python/209527
-Python's own pickle module uses identity lookups for object
-memoization: http://hg.python.org/cpython/file/0e70bf1f32a3/Lib/pickle.py#l234
+Several modules in the standard library use identity lookups for object
+memoization, for example ``pickle``, ``json``, ``copy``, ``cProfile``,
+``doctest`` and ``_threading_local``.
Copyright
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list