GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add type parameter and variance documentation to `collections.abc` (and potentially other modules?) · Issue #159222 · python/cpython

Add type parameter and variance documentation to collections.abc (and potentially other modules?) #159222

New issue
Copy link
New issue
Copy link
Open
Open
Add type parameter and variance documentation to collections.abc (and potentially other modules?)#159222
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided

Description

@decorator-factory
decorator-factory
opened on Oct 12, 2026
Issue body actions

Documentation

Currently, the only way to get up to date information on the type parameters and their variance for classes in collections.abc is to look at the source code of typeshed. I think it would be helpful to add that information to https://docs.python.org/3/library/collections.abc.html. For example, it could be something like

class collections.abc.Iterable[covariant T]

ABC for classes that provide the __iter__() method....
For type checking purposes, this class is considered a protocol, so assignability is checked structurally, not nominally.

class collections.abc.MutableMapping[invariant K, invariant V]
class collections.abc.Mapping[invariant K, covariant V]
ABCs for read-only and mutable mappings.
The key parameter is invariant in Mapping because <...>

(perhaps the variance words could link to the right place in the documentation describing these terms, for people unfamiliar with variance)

I'd like to work on that if possible. The specific way in which this information is presented might need to be discussed first.

Activity

  1. decorator-factory
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Oct 12, 2026
  2. github-project-automation
    added this to docs issueson Oct 12, 2026
  3. picnixz commented on Oct 12, 2026

    @picnixz
    picnixz
    on Oct 12, 2026
    Member
    More actions

    IIRC variance was decided to be left at typeshed discretion.

    cc @AlexWaygood @JelleZijlstra

  4. picnixz
    added
    pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
    on Oct 12, 2026
  5. kevinprimeraquecreo-stack
    added this to Project_VKon Oct 18, 2026
  6. github-project-automation
    moved this to Todo in Project_VKon Oct 18, 2026
  7. kevinprimeraquecreo-stack
    added this to Project_VKon Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirDocumentation in the Doc dirpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided

    Projects

    • docs issues
      Status
      Todo
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.