Explore >> Select a destination


You are here

florimond.dev
| | www.pmatiello.me
11.2 parsecs away

Travel
| | Implementing interface contracts in Python with class decorators
| | dafoster.net
13.8 parsecs away

Travel
| |
| | blog.nuculabs.de
8.4 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.
| | ericlathrop.com
75.9 parsecs away

Travel
| I often need to view a bunch of static HTML files in my browser locally, and I often need to open them with http:// rather than file:// URLs so related CSS or JavaScript files load correctly. Luckily, Python provides a simple web server, and most Linux distros include Python.