Re:Introduction to Python Decorators
by IgorPartola on Wednesday September 21, 2011 @04:54PM
(#3023649)
It's easy:
Now just do:
[ Parent
| on HN ]
Re:Introduction to Python Decorators
by stock_toaster on Thursday September 22, 2011 @04:34AM
(#3025340)
It is a bit more work if you want to create a decorator that can:
* decorate a class
* decorate a method
* have arguments
* have no arguments
extremely contrived example:
Note that the above only works for 'new style' classes (otherwise the type signature is not 'type').
edit: dumped code in a pastebin. it got kind of long.