Function metadata (like Java annotations) in Python

oripel oripel at gmail.com
Sun Sep 10 08:38:30 EDT 2006


Thanks!

Now I see it's accepted to assume nice decorators that update __dict__.
At least until __decorates__ or something similar is added...

fumanchu wrote:
> oripel wrote:
> > I'm trying to attach some attributes to functions and methods, similar
> > to Java annotations and .NET attributes.
> > ...
> > 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:
> >
> > @onedec
> > @attr(...)
> > @twodec
> > def foo():
> >   ...
> >
> > Given 'foo' now, how do I find the attributes?
> > ...
> > Any thoughts? Am I rehashing something old that my search skills didn't
> > uncover?
>
> There are past discussions about this; google for "python-dev decorator
> metadata". For example:
> http://thread.gmane.org/gmane.comp.python.devel/77506/focus=77507
>
>
> Robert Brewer
> System Architect
> Amor Ministries
> fumanchu at amor.org




More information about the Python-list mailing list