python / python/typeshed

Use `TypeForm` in __class_getitem__ for generics?

Open
#15,770 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.1k
Forks
2.1k
Avg merge
1d 19h
Merged PRs (30d)
82

Description

Now that TypeForm is in 3.15+ and typing_extensions, would it be reasonable to start using it in the __class_getitem__ stubs for generic classes? That way, we could reject constructs like list[3] without triggering false positives on things that are valid type expressions but not types.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the TypeForm documentation linked in the issue and inspecting the class_getitem stubs for generic classes. Determine the scope of applying TypeForm so invalid expressions such as list[3] can be rejected without false positives on valid type expressions; the issue names no specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.