Decorators proposal

Daniel Dittmar daniel.dittmar at sap.com
Tue Aug 10 12:09:54 EDT 2004


RebelGeekz wrote:
> Just my humble opinion:
>
> def bar(low,high):
>     meta:
>         accepts(int,int)
>         returns(float)
>     #more code
>
> Use a metadata section, no need to introduce new messy symbols, or
> mangling our beloved visual cleanliness of python.

+1

This also allows to set function properties inside of the function
def handler (match):
    meta:
        pattern = re.compile (...)

equivalent to

def handler (match):
    ...
handler.pattern = re.compile (...)

Daniel







More information about the Python-list mailing list