[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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant