[Python-Dev] Re: def ... decorate

Werner Schiendl ws-news at gmx.at
Fri Aug 13 19:52:48 CEST 2004


[Skip]
>
>     def p_statement_expr:
>         staticmethod
>         grammarrule('statement : expression')
>         version("Added in 2.4")
>         deprecatedmethod
>         type_(None)
>     decorate (self, p):
>         """docstring here"""
>         print p[1]
>

was the following suggested already? (don't think so):

     def p_statement_expr(self, p):
         staticmethod
         grammarrule('statement : expression')
         version("Added in 2.4")
         deprecatedmethod
         type_(None)
     body:
         """docstring here"""
         print p[1]


This would eliminate the problem of the moved parameters, yet keep all the
pros you listed.

The docstring could allowed to be with the decorators so that all
"meta-data" (from the perspective of a user) would be together.

/ Werner






More information about the Python-Dev mailing list

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant