SIGN IN SIGN UP

gh-149995: Update typing.py docstrings and documentation (#149996)

Some of these docstrings read as if they were written when typing.py was
first written, and things have evolved since then.

A few motivations:
- Call protocols protocols instead of ABCs. They are also ABCs, but the fact
  they are protocols is more relevant to typing.
- Avoid recommending direct use of .__annotations__ and steer users to
  annotationlib instead.
- For TypedDict, mention NotRequired before total=False since it is more
  general and probably more frequently useful.
- For overloads, mention runtime use first instead of stub use. I think early on
  there was talk of allowing overload only in stubs, but it is now heavily used at
  runtime too and that's more likely to be relevant to users.
J
Jelle Zijlstra committed
f159419ae2ef1aebbd90ce9427b55e27738c960c
Parent: c613f72
Committed by GitHub <noreply@github.com> on 5/22/2026, 4:06:42 AM