Skip to content

Move typing-related usage of PEP585 generics from typing docs to collections.abc #123523

Description

@sterliakov

Documentation

As pointed out in #123521, currently we have typing-related usage of PEP585 generics (Generator, Callable, Coroutine, etc.) explained on typing page. However, those aliases are deprecated, and there's no backlink from their collections.abc counterparts.

So, currently all users of the recommended modern option (collections.abc generics) have no documentation regarding their use in typing context at hand. Worse, classes there don't even have their generic arguments listed - only the name:

class collections.abc.Generator

This clearly should be fixed. At minimum the following needs to hold:

  • collections.abc aliases have their generic arguments listed in the docs
  • All typing-related info from corresponding typing docs entries should be reachable from collections.abc docs.

Upon some thinking I agree with @ZeroIntensity that moving all information to collections.abc and only retaining deprecation warning with a link in typing docs could be the most ergonomic option.

Linked PRs

Activity

  1. ZeroIntensity commented on Aug 31, 2024

    @ZeroIntensity
    Member

    @JelleZijlstra, as a typing expert, does this approach seem good to you?

  2. AA-Turner commented on Aug 31, 2024

    @AA-Turner
    Member

    As a user of collections generics, this would be quite useful, and seems appropriate now that Python 3.8 is nearing end-of-life. Happy to defer to others' views, though.

    A

  3. sterliakov commented on Aug 31, 2024

    @sterliakov
    ContributorAuthor

    I think +3 on the last comment is a good enough indicator - I'll grab this and open a PR soon.

  4. added a commit that references this issue on Sep 6, 2024
  5. added a commit that references this issue on Sep 6, 2024
  6. added 2 commits that reference this issue on Sep 6, 2024
  7. added a commit that references this issue on Sep 6, 2024
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions