[KongchangAI]
Concept

Decorator

A higher-order function syntax in Python used to modify or enhance the behavior of functions or classes, suitable for cross-cutting concerns such as logging and caching. However, stacking multiple decorators hides business logic and increases the cost of understanding.

Timeline (last 90 days)

Oct 16

Python decorators are applied from the bottom up: the decorator closest to the function wraps the original function first, and the topmost one wraps last; at execution time, control flow enters from the outermost layer and proceeds inward layer by layer.

Unverified50%
Oct 16

The stacking order of decorators directly determines the timing and scope of permission checks, retries, and transactions respectively, and these order differences are not reflected in the function signature, constituting implicit architectural decisions.

Unverified50%
Sep 12

If a permission check is merely a decorator wrapped around a function while the underlying function remains directly accessible (via import), the permission check can be bypassed.

Unverified50%

All Facts (3)

Source Articles