python-decorator | simplify usage of python decorators by programmers | Mehr ... |
Python 2.4 decorators have significantly changed the way Python programs are structured. * decorators help reduce boilerplate code; * decorators help separation of concerns; * decorators enhance readability and maintenability; * decorators are very explicit. Still, as of now, writing custom decorators correctly requires some experience and is not as easy as it could be. For instance, typical implementations of decorators involve nested functions and we all know that flat is better than nested. The aim of the decorator module it to simplify the usage of decorators for the average programmer and to popularize decorators usage giving examples of useful decorators, such as memoize, tracing, redirecting_stdout, locked, etc. |