Yet another decorator proposal

Marco Aschwanden PPNTWIMBXFFC at
Wed Aug 11 08:06:33 CEST 2004

Here is yet another decorator proposal:

def sumSequencesLengths(var1, var2):
     """Computes something very important.

     result = len(var1) + len(var2)
     return result

Decorators are important to communicate to the programmer. So, if someone 
wants to use decorators she better writes a documentation for it. So why 
not let the documentation enforce the whole decoration system?

The main advantages:
- Keeps the documentation up-to-date! The first language to do so (- 
doesn't it?)
- Enforces Python's readability further.
- Needs no new language constructs.

The main disadvantages:
- The values are frozen... the __decorators__ are set in a static string
- The definition follows after the def
- A "static" description has an impact on the "acting" program

There are really more pros and cons... it might be also only a 
"Schnapsidee" - after all I am no language designer.

Have a nice day,

More information about the Python-list mailing list