[Python-Dev] Re: Call for defense of @decorators
barry at python.org
Fri Aug 6 17:39:34 CEST 2004
On Thu, 2004-08-05 at 20:39, Fernando Perez wrote:
> If @ ends up being accepted, ipython can obviously adapt. I'll replace it with
> alternative syntax, be it @@, %, or some other kind of special-casing trick.
> It would not make me happy, and it worries me that ipython explicitly uses (for
> good reasons, I like to think), the three characters explicitly avoided by
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 '|'.
: wasn't bad, and it had some nice symmetry with the function definition
that follows. But those two little dots can be hard to read in some
fonts and I'm worried that because colons are so special in Python, it
might give existing tools some problems (python-mode had no problem with
/ and | also weren't bad, although bar is probably preferred.
Interestingly enough, in my font-lock settings, I italicize the
decorator line, so these two characters looked pretty similar. Someone
else pointing out that the bar kind of looks like it's anchoring the
decorator to the function, and I got a similar sense of that.
* was interesting because it evokes a feeling of a bulleted list, but
ultimately it looked too jarring.
= wasn't bad at all. It also had a bullet list feel to it, but without
the discomfort of using stars. This was my favorite of the
In summary, I can definitely sympathize with the concern of tool authors
who have settled on @ as a meta-character that Python will not use. I
wonder how the Leo or ipython folks would feel if the only change to the
current implementation of PEP 318 was to change the decorator
introducing character. If we can increase the community's consensus by
making this little change, I wouldn't oppose it.
My preference then would be to use = with | and : as alternatives, in
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20040806/014f8527/attachment.pgp
More information about the Python-Dev