[Python-Dev] Decorators: vertical bar syntax

Edward Loper edloper at gradient.cis.upenn.edu
Sat Aug 7 06:35:17 CEST 2004


The new "vertical bar" syntax was proposed recently, and has gotten
almost unanimously positive feedback.  In particular, of 17 responses
to the syntax, only one has been negative (see table, below).

I'm including both of the following variants:

     |classmethod
     |accepts(int, int)
     |returns(float)
     def foo(arg1, arg2):
         ...

     def foo(arg1, arg2):
         |classmethod
         |accepts(int, int)
         |returns(float)
         ...

(I prefer the second, but would be happy with either.)

The one negative comment was that "|" can look similar to "I" or "l",
depending on the font; but it's only an issue for some fonts, and it
should be largely mitigated by syntax-highlighting.

Guido's response to the vertical bar syntax is:
 > If the community can rally behind one of these, I think that would
 > be acceptable.  They all seem arbitrary, but so is the choice of
 > '@'. :-)
<http://mail.python.org/pipermail/python-dev//2004-August/047143.html>

So I wanted to see if anyone has anything *negative* to say about this
syntax (or one of its variants).  If possible, please respond by
updating the wiki, rather than by email.  This syntax is listed under
H (pre-def) and E2 (post-def).  You will need to sign in before you
can edit the wiki.

     Wiki: <http://www.python.org/cgi-bin/moinmoin/PythonDecorators>

(Feel free to update the wiki with positives, too, but I'm mainly trying 
to get a feel for whether anyone is strongly opposed to this syntax.)

-Edward

======================================================================
                  The Vertical Bar Decorator Syntax
======================================================================
History:                                             URL [1]
   First proposed (by Shalabh Chaturvedi) .../2004-August/047005.html
   Nested version proposed (by IxokaI)    .../2004-August/047170.html
   All tests pass if @ changed to |       .../2004-August/047189.html

Responses (sorted):                                  URL [1]
   +1    Shalabh Charturvedi              .../2004-August/047005.html
   +1    Richie Hindle                    .../2004-August/047078.html
   +1    Barry Warsaw                     .../2004-August/047133.html
                                     also .../2004-August/047207.html
   +1    Tim Peters                       .../2004-August/047147.html
   +1    Johannes Gijsbers                .../2004-August/047162.html
   +1    IxokaI                           .../2004-August/047170.html
   +1    Fernando Perez                   .../2004-August/047176.html
                                     also .../2004-August/047223.html
   +1    Mark Russell                     .../2004-August/047189.html
   +1    Anthony Baxter                   .../2004-August/047195.html
   +1    Raymond Hettinger                .../2004-August/047212.html
   +1    Edward Loper                            (this email)
   +1?   Holger Krekel                    .../2004-August/047213.html
   +0.5  Timothy Delaney                  .../2004-August/047007.html
   +0    GvR                              .../2004-August/047143.html
   +0?   Skip Montanaro                   .../2004-August/047192.html
   +0    Christian Tismer                 .../2004-August/047217.html
   -1    Bob Ippolito                     .../2004-August/047200.html

[1] All URLs are written in condensed form, 'cuz this email is too
     long already; to get a real URL, replace the "..." with
     "http://mail.python.org/pipermail/python-dev".



More information about the Python-Dev mailing list