Tag: Decorator
3 posts
-
Python Decorators: Writing @decorator Functions, Decorator Factories and functools.wraps
Write Python decorators for logging, caching, auth and retries, build decorator factories that take arguments, and keep metadata with functools.wraps.
-
Python Functions: Parameters, Defaults, Closures, and the Traps Behind Them
How Python functions really behave: positional-only and keyword-only parameters, the mutable default trap, late-binding closures, nonlocal, and functools.wraps.
-
The Decorator Pattern in C++: Adding Behavior by Composition (Streams, Logging, Formatters)
The Decorator pattern in C++: adding behavior at runtime through composition instead of inheritance, with stream decorators, a logging system, and a text formatter example.