Closed
Description
@hatal175 has been fixing several typeshed definitions and was recently looking at itertools. Many documented-as-functions in itertools are currently functions in typeshed, but actually classes at runtime, e.g. itertools.count
. The proposed change is to make them classes.
Pros:
- Makes typeshed consistent with runtime (albeit undocumented facet of the runtime)
- Allows users to do things that depend on these being classes, e.g. type checkers will understand
isinstance(x, itertools.count)
(admittedly rare)
Cons:
- Change can cause annoying false positives because type checkers are often strict about redefinition. E.g. Fix Generators typeshed test mypy#10255
My opinion is that we do nothing (except for maybe linking this issue in the allowlists ;-) ), since I think the con has a more real impact than the pros. Curious for others' thoughts?
Metadata
Metadata
Assignees
Labels
No labels