It's because it's the decorator object that's being called in both cases. To make it clearer, given this:
def my_decorator(a):
def wrapper(f):
def wrapped_function():
return f() + a
return wrapped_function
return wrapper
this:
@my_decorator(5)
def function():
return 5
is equivalent to this:
decorator = my_decorator(5)
@decorator
def function():
return 5
What's happening in the no-argument case is that the decorator gets invoked directly instead of having to return a function that takes the object to be decorated as a parameter.