Is the at sign a Decorator?
transcript
Python has an at sign called a decorator. Is it the Decorator pattern? Short answer: related. But not the same thing. Here is the difference.
Two at signs above a function. They're just syntax. The one nearest the function applies first. Doubled wraps fee. Then logged wraps that. The name now points at the outermost wrapper.
It can wrap. A function with the same signature, plus a behaviour. That's the pattern. It can register. A route decorator stores the function, and returns it as it is. Or it can change a class. Nothing is wrapped.
The pattern wraps an object, at run time, one instance at a time. You can pick the stack from a config. The at sign is applied once, where the function is defined, for every caller.
You can write the pattern without an at sign. And use an at sign without the pattern.
Full breakdown in the lecture.