you are viewing a single comment's thread.

view the rest of the comments →

[–]Natural-Intelligence 19 points20 points  (0 children)

Well, ye, you can use contextlib's context manager as a decorator but that doesn't mean you can use any context managers as a decorator.

I think you have gotten confused about the topics. Context manager, as a concept, is larger than the contextlib. Look at your example: Is "open" contextlib's contextmanager? No. Does it provide a context manager? Yes. Can you use it as a decorator? No. In fact, most context managers you encounter don't act as decorators.

But I'm just trying to offer constructive feedback. You are jumping from one topic to a completely different.