What should a decorator do if an attribute already exists?
Ethan Furman
ethan at stoneleaf.us
Tue May 10 13:52:36 EDT 2016
On 05/10/2016 08:45 AM, Steven D'Aprano wrote:
> I have a decorator that adds an attribute to the decorated function:
> My question is, what should I do if the decorated function already has an
> instrument attribute?
If the decorator is adding an attribute for the decorated thing to use,
and that thing may already have the correct attribute, do nothing;
otherwise, raise an exception.
--
~Ethan~
More information about the Python-list
mailing list