Another worthless decorator syntax suggestion

L

Larry Hastings

I didn't see this form of decorator syntax listed on the Python
Decorator Wiki, but that page is now frozen so I'm posting it here. I
realize the futility (and ignominy!) of posting such a thing,
especially at such a late date, so I'm happy to say I have absolutely
no ego invested in it ;)

Behold:

def foo(a, b),
classmethod,
synchronized,
martinized:
pass

Since these are operations on "foo", it doesn't make sense that they
be nested deeper than "foo", nor that they come before "foo"; those
are the two reasons I'm not a big booster of J2 (or of the
pie-syntax). Personally I think it's natural that they be indented at
the same level as the "def" but below it; the "def" and function name
are more important, so they should go first, but these are siblings of
the "def" and therefore should not be indented. After all, aren't the
name and arguments of a function just more attributes of the function?
And when you decorate a function in Python 2.3, the decoration code is
at the same level as the "def", so I assert that this *is*
semantically sensible, if syntactically unique. Furthermore, *not*
indenting the decorators helps visually set them apart from the
function body.

I could go on, but either I have your interest at this point or I
don't... elaborating won't help. I look forward to seeing the final
decision of our BDFL on this subject, as I suspect I will agree with
it.

Cheers,


/larry/
 
F

Fernando Rodríguez

He gave it - the pies win. Guido gave a very good/nice summary of why as

Yuck... A very bad decision, IMHO. One that takes Python's syntax closer to
Perl's mess.
 
I

Istvan Albert

Fernando said:
Yuck... A very bad decision, IMHO. One that takes Python's syntax closer to
Perl's mess.

Probably not. Perl aims to be a flexible language that tries to mimic
real languages in that even simple statements can be formulated
in many ways. The hope is that this will allow people to better express
the purpose of the code. Whether or not this is a realistic goal
is debatable (with all signs pointing to no ;-) ).

Istvan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top