A function decorator is just a function; you are free to do with it what you want.
Responding to the output of a decorated function is a fine usecase; it'd look something like:
from functools import wraps
def yourdecorator(func):
@wraps(func):
def wrapper(*args, **kw):
result = func(*args, **kw)
if result in certain_values:
adjust_other_configuration()
return result
return wrapper
where using @functools.wraps()
is a good practice to get into when writing decorators; this utility decorator copies across things like the function name, docstring and module name.