[Python-Dev] Re: Call for defense of @decorators
Michael McLay
mmclay at comcast.net
Fri Aug 6 20:06:31 CEST 2004
On Friday 06 August 2004 11:57 am, Guido van Rossum wrote:
> > So I spent a little time futzing with python-mode and some of my
> > decorator code, to try some alternative leading characters. Of the ones
> > that cannot be used in valid Python code today (i.e. no backward
> > compatibility issues), I tried ':', '/', '=', '*', and '|'.
>
> 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 '@'. :-)
Why was ';' not on Barry's list? It looks like it could be safely used as a
leading character.
>> def f():
... ; bar = 3
File "<stdin>", line 2
; bar = 3
^
SyntaxError: invalid syntax
>>> ; descriptor=42
File "<stdin>", line 1
; descriptor=42
^
SyntaxError: invalid syntax
Using ';' instead of '@' would also make creating a list of decorators on one
line consistent with other uses of ';' since ';' is already used to indicate
multiple statement on one line.
;framework_stuff(lots, of, args)
class Quux(object):
;check_args(int, str)
;counted ;staticmethod
def frobnicate(foo, bar):
pass
Admittedly the ';' does suffer from not being as visible as '@', but at least
the tail on the bottom dot makes it more readable than the ':' character.
The other downside is the potential confusion it might cause to geriatric
elisp programmers.
More information about the Python-Dev
mailing list