J2 decorator grammar

Paul McGuire ptmcg at austin.rr._bogus_.com
Mon Aug 23 02:07:21 EDT 2004


"Peter Maas" <crgre.znnf at hgvybt.qr> wrote in message
news:2orckjFdtljaU1 at uni-berlin.de...
> Robert Brewer schrieb:
> > Michael Sparks wrote:
> > For that reason (and others), I plan not to promote any form of the word
> > "decorate". We can start having that conversation now if you want. ;)
>
> What about
>
> with:
>      return ...
>      accept ...
>      classmethod
> def func():
>      <function body>
>
> "using" instead of "with" would be equally satisfactory for me. I don't
> like "decorate" because it sounds like "attaching some bells and whistles"
> or "making it look pretty" which isn't adequate for the meaning of this
> syntax.
>
> -- 
> Peter Maas, Aachen, Germany, Tel +49-241-38200 e-mail crgre.znnf at hgvybt.qr

"using" is tolerable for me, although it will be confusing for C++'ers who
will equate it with "namespace", and C#'ers who will equate it with "import"
(DLL).

As stated before, "with" and "as" are non-starters, "with" is reserved for
future use, "as" sounds too much like "rename".

"declare" is too broad a concept, and should be reserved for a time if/when
variable typing gets added to Python.

We should NOT select a keyword with an embedded '_' character.  I think
pre_def had been proposed at one point.  '_' is awkward to get to on some
international keyboards, IIRC.  (Of course, Python already uses scads of
'_'s elsewhere, so those people are out of luck.)

I'm also not keen on all caps keywords - some developers use all caps as an
indicator of defined constants, plus they are almost as eye-jarring as '@'.


I'm still partial to some of the prepositional options, or some truncated
words:

qual - I would hope that "qual" might get a second look.  The items in the
decorator suite can be thought of as qualifiers, or qualities of the
following function.  (Hmm, for our Spanish-speaking colleagues, "qual"
translates as "which", which might imply a selection from among the
decorators.  Boo.  Scratch "qual".)

per - Nice neutral Latin preposition; short, easy to type; used in "ad astra
per aspera" which is "to the stars through hope"

per:
    staticmethod
    memoize
    synchronize
def foo():
    pass

You can even read it, sort of: "per staticmethod def[ine] foo".


by - perhaps even too short, wont stand out when used


I'm liking "per" or "using".

-- Paul





More information about the Python-list mailing list