Skip to content

Conversation

AlexWaygood
Copy link
Member

Currently typing.Generator (a protocol) is generic over three type variables that have defaults, but types.GeneratorType (a concrete class) is generic over three type variables that do not have defaults. It seems like it probably makes more sense for them to be consistent? The vast majority of real-world Generators are instances of GeneratorType

AlexWaygood and others added 3 commits September 26, 2025 12:00
… parameters

Currently `Generator` is generic over three type variables that have defaults, but `GeneratorType` is generic over three type variables that do not have defaults. It seems like it probably makes more sense for them to be consistent? The vast majority of real-world `Generator`s are instances of `GeneratorType`
@AlexWaygood AlexWaygood changed the title Make GeneratorType type parameters consistent with Generator type parameters Make (Async)GeneratorType type parameters consistent with Generator type parameters Sep 26, 2025
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood marked this pull request as ready for review September 26, 2025 11:15
@AlexWaygood AlexWaygood changed the title Make (Async)GeneratorType type parameters consistent with Generator type parameters Make (Async)GeneratorType type parameters consistent with (Async)Generator type parameters Sep 26, 2025
@JelleZijlstra JelleZijlstra merged commit c7d0fd9 into main Sep 27, 2025
63 checks passed
@JelleZijlstra JelleZijlstra deleted the generator-type-typevars branch September 27, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants