Skip to content

Type annotation of windowed_complete is incorrect #880

@m472

Description

@m472

The docstring of windowed_complete specifies the following:

Yield ``(beginning, middle, end)`` tuples, where:

* Each ``middle`` has *n* items from *iterable*
* Each ``beginning`` has the items before the ones in ``middle``
* Each ``end`` has the items after the ones in ``middle``

It also provides an example where the iterable is of type Generator[int, None, None] and beginning, middle and end are always tuples of int. However the return type of windowed_complete is specified to be Iterator[tuple[_T, ...]]. According to this, in the example in the docstring the type of beginning, middle and end would be int, which is incorrect.

The correct return type annotation would be Iterator[tuple[tuple[_T, ...], tuple[_T, ...], tuple[_T, ...]]].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions