Skip to content

[Typing] batched revealed type? #13470

@ego-thales

Description

@ego-thales

Bug report

Bug description:

Hi!

Consider the following.

from functools import reduce
from itertools import batched

x = reduce(batched, [1], (1,))

It makes mypy unhappy!

error: Argument 1 to "reduce" has incompatible type "type[batched[Any]]"; expected "Callable[[tuple[int], int], tuple[int]]"  [arg-type]

I did try to previously type hint the tuple with

the_tuple: tuple[int, ...] = (1,)

But the error remains the same.

It may be that I'm not understanding something elementary in which case, thanks for the help! Otherwise, is this a problem of batched or something deeper?

Thanks!

CPython versions tested on:

3.13

Operating systems tested on:

Linux

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