Function metadata (like Java annotations) in Python
oripel at gmail.com
Sun Sep 10 04:13:28 CEST 2006
I'm trying to attach some attributes to functions and methods, similar
to Java annotations and .NET attributes.
I also want to use a convenient decorator for it, something along the
Assigning attributes to the function will work, as will assigning keys
and values to a dictionary in an attribute. But if there are more
decorators in the way, this could fail:
Given 'foo' now, how do I find the attributes?
Assigning to a global attribute registry (some interpreter-global
dictionary), although less desirable, might have been acceptable, but
then how do I identify the function after it's been wrapped in more
Also, it may be nice to have the following work as well:
Any thoughts? Am I rehashing something old that my search skills didn't
More information about the Python-list