This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mitar
Recipients mitar
Date 2010-07-05.01:28:12
SpamBayes Score 0.01584259
Marked as misclassified No
Message-id <1278293295.3.0.202692223524.issue9157@psf.upfronthosting.co.za>
In-reply-to
Content
Sometimes it is useful to be able to check which decorators are already applied to a function, especially when you are constructing them dynamically. I am proposing that for all decorators in Python would be suggested that they maintain a list of used decorators on a function. It is most useful when all decorators do this.

It is the same reasoning why `inspect` module is in Python - to be able to inspect Python structures, to have this possibility. If you do not want it then you do can use Python structures as they were given to you. But you have an option to inspect them.

And I would like the same to see from decorators. It is not really so important that all decorators update this. If they would not then they would be hidden from inspection. But if developer wants to use inspection then he would choose such decorators which use this (or change them in this way). If all default Python's decorators would already be such it would be much easier to use them.

This could be implement by changing `wraps` function to pass over also the (for example) `__DECORATORS__` attribute of a function to a wrapped function and add this new decorator to a list, `__DECORATORS__`.

By default in a list ids of decorators would be maintained, but this could be overridden by `id` attribute of `wraps` function so that decorator can represent itself in some special way, for example as a tuple of its id and some significant parameters.
History
Date User Action Args
2010-07-05 01:28:15mitarsetrecipients: + mitar
2010-07-05 01:28:15mitarsetmessageid: <1278293295.3.0.202692223524.issue9157@psf.upfronthosting.co.za>
2010-07-05 01:28:13mitarlinkissue9157 messages
2010-07-05 01:28:12mitarcreate