Skip to content

Make the 2 last parameters for typing.Generator optional #4221

Closed
@sametmax

Description

@sametmax

If I use:

Generator[int]

mypy complains:

error: "Generator" expects 3 type arguments, but 1 given

I can silence mypy by doing:

Generator[int, None, None]

But given that the majority of generators just yield, rarely return or send, I think it would make sense to allow the last 2 parameters to have a default value of None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions