-
Notifications
You must be signed in to change notification settings - Fork 259
Proposal: ContextManager interface #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yeah, and in Python 3.6 there's contextlib.AbstractContextManager in the |
I was just going to propose what Guido is suggesting above (based on discussion in python/typeshed#1200). Since this issue has already been open for months with no objection to the idea, I'll send a PR instead. |
So that there is a way to type hint for a context manager even on language versions before 3.6. This is just copied from contextlib.AbstractContextManager in 3.6. Fixes python#274
So that there is a way to type hint for a context manager even on language versions before 3.6. This is just copied from contextlib.AbstractContextManager in 3.6. Fixes python#274
So that there is a way to type hint for a context manager even on language versions before 3.6. This is just copied from contextlib.AbstractContextManager in 3.6. Fixes #274
Because context managers are a language feature (for use in
with
blocks), typing should expose an interface class for them like it does with Dict, List, etc.The typeshed for contextlib defines an interface for a ContextManager because it needs it in the return type for
contextlib.contextmanager
, but it seems like the kind of thing that should be in typing, not in a random stub.The text was updated successfully, but these errors were encountered: