[New-bugs-announce] [issue46669] Add types.Self

Raymond Hettinger report at bugs.python.org
Sun Feb 6 18:12:51 EST 2022

New submission from Raymond Hettinger <raymond.hettinger at gmail.com>:

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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list