How to avoid "()" when writing a decorator accepting optional arguments?

Ethan Furman ethan at stoneleaf.us
Fri Jun 17 13:18:07 EDT 2011


Giampaolo Rodolà wrote:
> I've written this decorator to deprecate a function and (optionally)
> provide a callable as replacement

I can see providing the replacement function so that you can say, for 
example, "you are calling a deprecated function -- <function xyz> is the 
replacement".

If your replacement function is drop-in compatible, though, why bother 
with the whole deprecate decorator?  Just drop it in!  :)

~Ethan~



More information about the Python-list mailing list