[Python-checkins] peps: PEP 422: Update Deferral note & other tweaks
nick.coghlan
python-checkins at python.org
Sun Feb 22 16:15:06 CET 2015
https://hg.python.org/peps/rev/ef12b7584922
changeset: 5702:ef12b7584922
user: Nick Coghlan <ncoghlan at gmail.com>
date: Mon Feb 23 01:14:58 2015 +1000
summary:
PEP 422: Update Deferral note & other tweaks
files:
pep-0422.txt | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/pep-0422.txt b/pep-0422.txt
--- a/pep-0422.txt
+++ b/pep-0422.txt
@@ -27,12 +27,17 @@
implementing a custom metaclass, and thus should provide a gentler
introduction to the full power Python's metaclass machinery.
+
PEP Deferral
============
-Deferred until 3.5 at the earliest. The last review raised a few interesting
-points that I (Nick) need to consider further before proposing it for
-inclusion, and that's not going to happen in the 3.4 timeframe.
+Currently deferred pending updates to address feedback received prior to the
+Python 3.4 release (see TODO note below).
+
+Note that I'd be open to relinquishing the PEP to a new champion if anyone
+would like to propose it for Python 3.5 (while I've made a few updates to
+the design recently it doesn't currently look like I will be in a position
+to push it forward myself in the 3.5 time frame).
Background
@@ -204,7 +209,7 @@
stated "subclass of type" for a constraint that is actually "instance of
type".
-Understanding the proposed class initialisation hook only requires
+Understanding the proposed implicit class decoration hook only requires
understanding decorators and ordinary method inheritance, which isn't
quite as daunting a task. The new hook provides a more gradual path
towards understanding all of the phases involved in the class definition
@@ -268,6 +273,7 @@
if cls is __class__:
return
# Process subclasses here
+ ...
New Ways of Using Classes
@@ -330,7 +336,7 @@
Extending a class
-----------------
-.. note:: Just because the PEP makes it *possible* to do this relatively,
+.. note:: Just because the PEP makes it *possible* to do this relatively
cleanly doesn't mean anyone *should* do this!
::
@@ -385,6 +391,9 @@
relied on the ``__class__`` reference (or used the zero-argument form of
``super()``), and could not make use of those features themselves.
+The current design instead ensures that the implicit decorator hook is able
+to do anything an explicit decorator can do by running it after the initial
+class creation is already complete.
Calling the automatic decoration hook ``__init_class__``
--------------------------------------------------------
@@ -397,7 +406,7 @@
* the use of "init" in the name suggested the signature should match that
of ``type.__init__``, which is not the case
* the use of "init" in the name suggested the method would be run as part
- of class construction, which is not the case
+ of initial class object creation, which is not the case
The new name ``__autodecorate__`` was chosen to make it clear that the new
initialisation hook is most usefully thought of as an implicitly invoked
--
Repository URL: https://hg.python.org/peps
More information about the Python-checkins
mailing list