Hacker News new | ask | show | jobs
by stock_toaster 5384 days ago
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:

http://pastebin.com/GBuYL2af

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.