# Class Decorator

say it: **“klas DEK-uh-ray-ter”** **/klæs ˈdɛkəˌreɪtər/**

A decorator placed on a class to change or register the whole class.

## What is a **class decorator**?

A **class decorator** is a decorator placed on a class instead of a function, so it can change or register the whole class. `@dataclass` is one.

```python
handlers = {}

def handles(event):
    def register(cls):
        handlers[event] = cls
        return cls
    return register

@handles("order_placed")
class SendReceipt:
    pass

print(handlers)  # {'order_placed': <class 'SendReceipt'>}
```

Level: Master · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=5)

Updated: November 17, 2026

Source: https://www.ask-codey.com/glossary/class-decorator
