[Python-Dev] Re: A syntax for function attributes?
Mark Nottingham
mnot at mnot.net
Sat Aug 16 22:41:34 EDT 2003
I very much like this approach, and reiterate my willingness to help
push it (or another solution) forward however I can (probably limited
to writing a PEP, unfortunately).
Cheers,
Paul Moore wrote:
> All of the notations involving "stuff" between the definition and the
> colon look reasonable when the "stuff" is small, but start to look odd
> when it gets bigger (because it usually means that the colon is not on
> the same line as the "def").
>
> How about leaving the [...] construct between the args and the colon,
> on the assumption that "normal use" is for short stuff, like
> [classmethod]. But for the dictionary option for function attributes,
> locate it after the docstring. The we have
>
> def p_expr_term(self,args):
> """docstring here"""
> { 'rule' :
> """expr ::=3D expr + term
> term ::=3D term * factor"""
> }
>
> pass
>
> It may get (slightly) hairy to parse, but should be OK, as docstrings
> are a precedent for bare literals at the start of a function
> definition having special meaning.
>
> Paul.
More information about the Python-Dev
mailing list