[Python-Dev] Re: Call for defense of @decorators (original) (raw)
Barry Warsaw barry at python.org
Fri Aug 6 17:39:34 CEST 2004
- Previous message: [Python-Dev] Re: Call for defense of @decorators
- Next message: [Python-Dev] Re: Call for defense of @decorators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 python:
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 it though).
/ 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 alternatives.
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 that order.
-Barry
-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-dev/attachments/20040806/014f8527/attachment.pgp
- Previous message: [Python-Dev] Re: Call for defense of @decorators
- Next message: [Python-Dev] Re: Call for defense of @decorators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]