[Python-Dev] Decorators: vertical bar syntax

Neil Hodgson nhodgson at bigpond.net.au
Sat Aug 7 08:10:54 CEST 2004


Edward Loper:


> 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).
> ...
> So I wanted to see if anyone has anything *negative* to say about this
> syntax (or one of its variants).

   One advantage of '@' is that, since it is currently not found in Python
code, it is a very strong escape that can be inserted anywhere. For example,
if there is later a need or desire to annotate function arguments
individually as well as functions, or individual statements or expressions,
then @ is a better choice. For example

@RemoteCall
def Ignite(engine @Remote, environment @Copy, thrust @Float):

   may be better at associating annotations more closely with their targets
than

@RemoteCall
@Types(["p", "p", "f"])
@Copy("environment")
def Ignite(engine, environment, thrust):

   Neil



More information about the Python-Dev mailing list