[Python-checkins] python/nondist/peps pep-0318.txt,1.25,1.26
montanaro at users.sourceforge.net
montanaro at users.sourceforge.net
Tue Aug 24 20:56:13 CEST 2004
Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11703
Modified Files:
pep-0318.txt
Log Message:
List some possible reasons why arriving at consensus about decorators has
been so hard (or impossible) to acheive. There are certainly more. Are
these the killers?
Index: pep-0318.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- pep-0318.txt 24 Aug 2004 05:50:01 -0000 1.25
+++ pep-0318.txt 24 Aug 2004 18:56:00 -0000 1.26
@@ -78,6 +78,41 @@
decorators are being added.
+Why Is This So Hard?
+--------------------
+
+A couple decorators (``classmethod()`` and ``staticmethod()``) have
+been available in Python since version 2.2. It's been assumed since
+approximately that time that some syntactic support for them would
+eventually be added to the language. Given this assumption, one might
+wonder why it's been so difficult to arrive at a consensus.
+Discussions have raged off-and-on at times in both comp.lang.python
+and the python-dev mailing list about how best to implement function
+decorators. There is no one clear reason why this should be so, but a
+few problems seem to be most problematic.
+
+* Disagreement about where the "declaration of intent" belongs.
+ Almost everyone agrees that decorating/transforming a function at
+ the end of its definition is suboptimal. Beyond that there seems to
+ be no clear consensus where to place this information.
+
+* Syntactic constraints. Python is a syntactically simple language
+ with fairly strong constraints on what can and can't be done without
+ "messing things up" (both visually and with regards to the language
+ parser). There's no obvious way to structure this information so
+ that people new to the concept will think, "Oh yeah, I know what
+ you're doing." The best that seems possible is to keep new users
+ from creating a wildly incorrect mental model of what the syntax
+ means.
+
+* Overall unfamiliarity with the concept. For people who have a
+ passing acquaintance with algebra (or even basic arithmetic) or have
+ used at least one other programming language, much of Python is
+ intuitive. Very few people will have had any experience with the
+ decorator concept before encountering it in Python. There's just no
+ strong preexisting meme that captures the concept.
+
+
Background
==========
More information about the Python-checkins
mailing list