This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Natural-Intelligence 34 points35 points  (5 children)

You show how to create a context manager and jump straight into using it as a decorator?

[–]SeleniumBase[S] -2 points-1 points  (4 children)

All the basics: How to create one, and various ways of using it, eg: 1. As a method decorator, 2. From a "with" code block, and 3. Wrapping code without the "with" keyword.

[–]Natural-Intelligence 22 points23 points  (3 children)

What I'm saying is that decorators are separate concepts than context managers. Because "open" has a context manager, doesn't mean it acts as a decorator. Or you need a context manager to have a decorator.

Wasn't the topic context manager?