Yet another decorator proposal

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Wed Aug 11 03:29:26 EDT 2004


Marco Aschwanden wrote:
> Here is yet another decorator proposal:
> 
> def sumSequencesLengths(var1, var2):
>      """Computes something very important.
> 
>      __decorators__:
>          staticmethod

I think this is not a great idea, for several reasons:

- Decorators are inside the function. I'm not generally against that,
but I agree that decorators are something important that, e.g., should
not be folded away.
- Decorators are "hidden" in a string. This is almost as ugly as the
meta-constructs some other languages have, hiding vital information in
comments.
- The indentation, if it is a crucial part of your proposal, is not
clear. Remember that docstrings are strings, and as such have no notion
of the current indentation of the function block.

Sorry, but if decorators should go into the body, I'm sure they will
take such a form:

def SomeFunction(param):
    meta:
        staticmethod
    <code>

Reinhold

-- 
Wenn eine Linuxdistribution so wenig brauchbare Software wie Windows
mitbrächte, wäre das bedauerlich.  Was bei Windows der Umfang eines
"kompletten Betriebssystems" ist, nennt man bei Linux eine Rescuedisk.
  -- David Kastrup in de.comp.os.unix.linux.misc



More information about the Python-list mailing list