Ivan Levkivskyi added the comment: Or you can use typing.ContextManager[ret_type] if you like generics (typing.AsyncContextManager will be also added soon).
Also this recent discussion seems relevant https://github.com/python/peps/pull/242 and the corresponding thread on python-dev: https://www.mail-archive.com/python-dev@python.org/msg95595.html ---------- nosy: +levkivskyi _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30359> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com