[Python-checkins] python/nondist/peps pep-0318.txt,1.3,1.4

goodger at users.sourceforge.net goodger at users.sourceforge.net
Sat Feb 28 14:09:47 EST 2004


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5886

Modified Files:
	pep-0318.txt 
Log Message:
update from Kevin Smith

Index: pep-0318.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pep-0318.txt	29 Jul 2003 15:31:13 -0000	1.3
--- pep-0318.txt	28 Feb 2004 19:09:44 -0000	1.4
***************
*** 9,13 ****
  Created: 05-Jun-2003
  Python-Version: 2.4
! Post-History: 09-Jun-2003, 10-Jun-2003
  
  
--- 9,13 ----
  Created: 05-Jun-2003
  Python-Version: 2.4
! Post-History: 09-Jun-2003, 10-Jun-2003, 27-Feb-2004
  
  
***************
*** 96,103 ****
  
      where DECORATORS is a comma-separated list of expressions, 
!     or a tuple.
  
!     Other syntaxes have been proposed in comp.lang.python.  The 
!     most common are demonstrated below.
  
          def foo(self) [synchronized(lock), classmethod]:
--- 96,143 ----
  
      where DECORATORS is a comma-separated list of expressions, 
!     or a tuple.  Using the latter form, the last example above 
!     would look like:
  
!         def foo(self) as (synchronized(lock), classmethod):
!             perform method operation
! 
!     This form make is possible for the list of decorators to
!     span multiple lines without using the line continuation operator.
! 
! Alternate Syntaxes
! 
!     Other syntaxes have been proposed in comp.lang.python and 
!     python-dev.  Unfortunately, no one syntax has come out as a clear
!     winner in the lengthy discussions.  The most common suggestions
!     are demonstrated below.  The proposed syntax is also included
!     for easy comparison.
! 
!     Proposed Syntax
! 
!         def foo(self) as synchronized(lock), classmethod:
!             perform method operation
! 
!         def foo(self) as (synchronized(lock), classmethod):
!             perform method operation
! 
!     Prefix Forms
! 
!         def [synchronized(lock), classmethod] foo(self):
!             perform method operation
! 
!         def synchronized(lock), classmethod foo(self):
!             perform method operation
! 
!         # Same as above, but only identifiers are allowed
!         sync = synchronized(lock)
!         def sync, classmethod foo(self):
!             perform method operation
! 
!         # Java-like
!         sync = synchronized(lock)
!         def @sync @classmethod foo(self):
!             perform method operation
! 
!     Postfix Forms
  
          def foo(self) [synchronized(lock), classmethod]:
***************
*** 110,119 ****
              perform method operation
  
!     These three forms use syntax that just seems arbitrary and which 
!     does not help the user to comprehend the meaning of it.  In 
!     addition, since the order in which the decorators are applied 
!     may matter, the third, dictionary-style, syntax must be 
!     eliminated.  
! 
      
  Implementation Issues
--- 150,160 ----
              perform method operation
  
!     I'm not as fond of the forms that use '[ ]' since code like
!     'foo()[a]' looks as if you are getting the item 'a' from 'foo()'.
!     Although, this isn't as much of an issue when using '[ ]' in
!     a prefix form.  The Java-like syntax adds new syntax that is 
!     very arbitrary and is almost Perl-ish.  In addition, since the 
!     order in which the decorators are applied may matter, the last,
!     dictionary-style, syntax must be eliminated.  
      
  Implementation Issues
***************
*** 152,155 ****
--- 193,204 ----
      name when the 'def' statement is executed.
  
+ Open Issues
+ 
+     It is not clear at the moment if it is even possible to have
+     multiple decorators for a function.  If decorators are required
+     to take a function/method and return a descriptor, it might 
+     not even be possible to wrap multiple decorators.  This should
+     be explored since the best syntax for multiple decorators
+     may not be the same as the best syntax for a single decorator.
  
  Current Implementations




More information about the Python-checkins mailing list