zeekay / decorum

Python decorator helper library.
MIT License
14 stars 2 forks source link

Decorum.__call__() should first check self._wrapped #24

Open benoitbryon opened 9 years ago

benoitbryon commented 9 years ago

See https://github.com/zeekay/decorum/blob/0.5.3/decorum/decorum.py#L46 What about improving this code by checking self._wrapped first?

Something like:

if self._wrapped is None:
    if f is None:
        raise Exception('Need something to decorate!')
    return self.wraps(f)
else:
    return self._wrapped(*args, **kwargs)  # Actually run the decorated function.