[Typing] `batched` revealed type?
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 5.1k
- Fork
- 2.1k
- Merge medio
- 1g 19h
- PR unite (30g)
- 82
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Nel report non è indicato alcun percorso di file o di test. Inizia esaminando lo stub di typeshed per itertools.batched e la tipizzazione di reduce, quindi riproduci l’errore mypy fornito con l’esempio Python 3.13. Il lavoro è completato quando il comportamento previsto è stato risolto ed è coperto da un controllo appropriato di typeshed.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- developer-experience
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100