views:

145

answers:

2

I need to mark routines as deprecated, but apparently there's no standard library decorator for deprecation. I am aware of recipes for it and the warnings module, but my question is: why is there no standard library decorator for this (common) task ?

Additional question: are there standard decorators in the standard library at all ?

+2  A: 

classmethod(), staticmethod(), and the various property decorators are the important ones. There's also one in contextlib, and a few other lesser-used ones.

Ignacio Vazquez-Abrams
+1  A: 

I guess the reason is that Python code can't be processed statically (as it done for C++ compilers), you can't get warning about using some things before actually using it. I don't think that it's a good idea to spam user of your script with a bunch of messages "Warning: this developer of this script is using deprecated API".

ony
yes, but if the users is me running my testsuites...
Stefano Borini