[Python-Dev] def ... decorate (original) (raw)

Raymond Hettinger python at rcn.com
Fri Aug 13 20:11:06 CEST 2004


I've kept my nose out of the decorator discussion, but I thought I would give my opinion on this one...

> On Fri, 13 Aug 2004, Skip Montanaro wrote: > > >with > > > > def pstatementexpr: > > staticmethod > > grammarrule('statement : expression') > > version("Added in 2.4") > > deprecatedmethod > > type(None) > > decorate (self, p): > > """docstring here""" > > print p[1] > > Bingo! Oh god no. > Just replace decorate with "from" and the nice syntax is found: > > def f: > staticmethod > grammarrule('statement : expression') > version("Added in 2.4") > deprecatedmethod > type(None) > from self, p: > """docstring here""" > print p[1] Gah, the horror.

I think we should take maximum advantage of prior art. Other languages have proven the efficacy of backwards spellings. Likewise, the reST module has proven the utility of ASCII markup.

dothemcitats::
elurrammarg  ``statement : expression''::
dohtemdetacerped::
``````````````````
def f(arg):
     . . .

Advantages:

Alternative:

A further application of prior art would be to hypergeneralize the solution to this problem and design a solution using XML. This takes maximum advantage of existing tools while providing a framework for all potential future proposals to add a second or third way to accomplish things we can already do now.

citsacras-ly yours,

Raymond



More information about the Python-Dev mailing list