New submission from Raymond Hettinger <[email protected]>:
Typeshed now has a nice self-describing type variable to annotate context
managers:
Self = TypeVar('Self')
def __enter__(self: Self) -> Self:
return self
It would be nice to have that in the standard library types module as well.
----------
messages: 412682
nosy: Jelle Zijlstra, gvanrossum, rhettinger
priority: normal
severity: normal
status: open
title: Add types.Self
versions: Python 3.11
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46669>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com