Now that this old thread is back at the top anyway, lemme just throw in some Decorator-ception:
def magical_decorator(decorator):
@wraps(decorator)
def inner(*args, **kw):
if len(args) == 1 and not kw and callable(args[0]):
return decorator()(args[0])
else:
return decorator(*args, **kw)
return inner
Now your magical decorator is just a single line away!
@magical_decorator
def foo_register(...):
# bla bla
By the way, this works for any decorator. It just causes @foo to behave (as close as possibly) like @foo().