[Python-Dev] Re: Re: Call for defense of @decorators

Johannes Gijsbers jlg at python.org
Fri Aug 6 18:52:28 CEST 2004


On Fri, 06 Aug 2004 11:39:34 -0400, Barry Warsaw wrote:

> = 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.

'=' has too srong an association with assignment for me, The first thing I
wondered was where the '=' was assigning to. Then I realized that, in the
context of decorators, it has to be the function/method that follows. So
in the following example:

=classmethod
def foo(arg1,arg2):
    ...

'foo' '=' a classmethod. This does broaden the meaning of '=' from just
equality of identity to belonging to a group, but that's mostly okay.
However, the next example really bugs me:

=accepts(int,int)
=returns(float)
def bar(low,high):
    ...

'bar' '=' in no sense an 'accepts' or a 'returns'. It doesn't seem right
to use an assignment operator for decorating.

Keeping Tim's comments about ':' in mind, my personal favorite is '|'.

Johannes



More information about the Python-Dev mailing list