Decorating functions without losing their signatures

Michele Simionato michele.simionato at gmail.com
Wed Apr 3 21:18:47 EDT 2013


On Wednesday, April 3, 2013 3:05:31 AM UTC+2, Rotwang wrote:
> After thinking about it for a while I've come up with the following 
> 
> abomination


Alas, there is actually no good way to implement this feature in pure Python without abominations. Internally the decorator module does something similar to what you are doing. However, instead of cooking up yourself your custom solution, it is probably better if you stick to the decorator module which has been used in production for several years and has hundreds of thousands of downloads. I am not claiming that it is bug free, but it is stable, bug reports come very rarely and it works for all versions of Python from 2.5 to 3.3.



More information about the Python-list mailing list