Another worthless decorator syntax suggestion

Larry Hastings larry at hastings.org
Tue Sep 14 11:45:51 CEST 2004


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/



More information about the Python-list mailing list