[Python-Dev] method decorators (PEP 318) (original) (raw)

Peter Otten Peter.Otten at t-online.de
Fri Mar 26 15:28:39 EST 2004


Yet another variant that deals with "passive" metadata: make the first dictionary special just like the first string.

def foobar(): ... { author = "van Rossum", ... deprecated = True } ... foobar.deprecated True

Even better, stash it all away in a another attribute:

foobar.meta {"author": "van Rossum", "deprecated": "not yet"}

This would work for both functions and classes. Fitting in nicely: the alternative spelling for all dictionaries:

{alpha="value", beta="another value"}

Peter Otten



More information about the Python-Dev mailing list