M
Marco Aschwanden
Here is yet another decorator proposal:
def sumSequencesLengths(var1, var2):
"""Computes something very important.
__decorators__:
staticmethod
__parameters__:
var1=Sequences
var2=Sequences
__returns__:
int
"""
result = len(var1) + len(var2)
return result
Reasoning:
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,
Marco
def sumSequencesLengths(var1, var2):
"""Computes something very important.
__decorators__:
staticmethod
__parameters__:
var1=Sequences
var2=Sequences
__returns__:
int
"""
result = len(var1) + len(var2)
return result
Reasoning:
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,
Marco