[Python-checkins] peps: Reject PEP 416 (frozendict) with reasons why.
guido.van.rossum
python-checkins at python.org
Thu Mar 22 00:47:34 CET 2012
http://hg.python.org/peps/rev/372f8123c1bd
changeset: 4143:372f8123c1bd
user: Guido van Rossum <guido at google.com>
date: Wed Mar 21 16:47:27 2012 -0700
summary:
Reject PEP 416 (frozendict) with reasons why.
files:
pep-0416.txt | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/pep-0416.txt b/pep-0416.txt
--- a/pep-0416.txt
+++ b/pep-0416.txt
@@ -3,13 +3,40 @@
Version: $Revision$
Last-Modified: $Date$
Author: Victor Stinner <victor.stinner at gmail.com>
-Status: Draft
+Status: Rejected
Type: Standards Track
Content-Type: text/x-rst
Created: 29-February-2012
Python-Version: 3.3
+Rejection Notice
+================
+
+I'm rejecting this PEP. A number of reasons (not exhaustive):
+
+ * According to Raymond Hettinger, use of frozendict is low. Those
+ that do use it tend to use it as a hint only, such as declaring
+ global or class-level "constants": they aren't really immutable,
+ since anyone can still assign to the name.
+ * There are existing idioms for avoiding mutable default values.
+ * The potential of optimizing code using frozendict in PyPy is
+ unsure; a lot of other things would have to change first. The same
+ holds for compile-time lookups in general.
+ * Multiple threads can agree by convention not to mutate a shared
+ dict, there's no great need for enforcement. Multiple processes
+ can't share dicts.
+ * Adding a security sandbox written in Python, even with a limited
+ scope, is frowned upon by many, due to the inherent difficulty with
+ ever proving that the sandbox is actually secure. Because of this
+ we won't be adding one to the stdlib any time soon, so this use
+ case falls outside the scope of a PEP.
+
+On the other hand, exposing the existing read-only dict proxy as a
+built-in type sounds good to me. (It would need to be changed to
+allow calling the constructor.)
+
+
Abstract
========
@@ -26,7 +53,8 @@
Use cases:
* Immutable global variable like a default configuration.
- * Default value of a function parameter. Avoid the issue of mutable default arguments.
+ * Default value of a function parameter. Avoid the issue of mutable default
+ arguments.
* Implement a cache: frozendict can be used to store function keywords.
frozendict can be used as a key of a mapping or as a member of set.
* frozendict avoids the need of a lock when the frozendict is shared
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list