> Every page of the ganymede website is listed in https://eugo.io/docs/ganymede/llms.txt.

# Decorator

> Make it easy to define signature-preserving function decorators and decorator factories. A Python demo notebook from ganymede.

Web page: https://eugo.io/docs/ganymede/demo_notebooks/utilities/decorator/
Notebook: https://eugo.io/docs/ganymede/demo_notebooks/utilities/decorator/decorator.ipynb (source: https://github.com/eugo-inc/ganymede/blob/main/demo_notebooks/utilities/decorator.ipynb)

Description:
- Make it easy to define signature-preserving function decorators and decorator factories.

Resources:
- [GitHub] https://github.com/micheles/decorator
- [Docs] https://github.com/micheles/decorator/blob/master/docs/documentation.md

## Example 1

Create a simple decorator to trace a function

```python
from inspect import getfullargspec
from decorator import decorate


def _trace(f, *args, **kw):
     kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw))
     print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr))
     return f(*args, **kw)

def trace(f):
     return decorate(f, _trace)

@trace
def f1(x):
    pass


print(f1(0))

# Verify
print(getfullargspec(f1))
```
