[Python-ideas] a few decorator recipes
Mathias Panzenböck
grosser.meister.morti at gmx.net
Sat May 14 19:57:32 CEST 2011
So there is a standard place to store such metadata.
See how I use it here (scroll all the way down):
https://bitbucket.org/panzi/functools_plus/src
-panzi
On 04/30/2011 09:17 PM, Benjamin Peterson wrote:
> Mathias Panzenböck<grosser.meister.morti at ...> writes:
>>
>> def annotations(**annots):
>> def deco(obj):
>> if hasattr(obj,'__annotations__'):
>> obj.__annotations__.update(annots)
>> else:
>> obj.__annotations__ = annots
>> return obj
>> return deco
>
> Why would you want to do that?
>
>>
>> def setannot(obj, key, value):
>
> I don't see the point.
>
>
More information about the Python-ideas
mailing list