Explore >> Select a destination


You are here

yasoob.me
| | aaronluna.dev
11.8 parsecs away

Travel
| | Decorators can be a daunting topic when first encountered. While the Zen of Python states "There should be one- and preferably only one -obvious way to do it", there are many, equally valid ways to implement the same decorator. These different methods can be categorized as either function-based, class-based, or a hybrid of both. In this post I will explain the design and behavior of Python decorators and provide examples of decorators that I frequently use in my own code.
| | blog.nuculabs.de
13.8 parsecs away

Travel
| | Hello, In this short article I would like to talk about context managers. I personally consider that at the core they are just a form of decorators. If you don't know what a decorator is check the Decorator Pattern Wikipedia article. Decorators can be used to implement cross-cutting concerns. We have componentA and we need logging and security, we could write the logic for logging and security handling in componentA but some people consider component a should be componentA not componentAthatAlsoKnowsAboutSecurityAndOtherStuff. Since it's not the component's responsibility to authorize requests or log calls to a external logging service, we can wrap the componentA into a decorator that does just that.
| | kishstats.com
15.0 parsecs away

Travel
| | functools is part of the Python standard library which is defined as being a "module is for higher-order functions" and that "functions that act on or return...
| | nick.zoic.org
95.9 parsecs away

Travel
|