itertools' all_equal
recipe causes false arg-type failures
#15150
Labels
all_equal
recipe causes false arg-type failures
#15150
Bug Report
Adding annotations to the itertools recipe for
all_equal
results in a false "arg-type" error message from mypy. This can be worked around by adding an intermediate argument, but the intermediate argument doesn't have any functional impact, so I think this must be a bug.To Reproduce
Playground link: https://mypy-play.net/?mypy=latest&python=3.11&gist=012171f435d6fd0119ac028acc794877
The following two functions, both based on the
all_equal
recipe in the official Python itertools documentation, work identically. Howeverall_equal_error
produces an "arg-type" error from mypy, whileall_equal_pass
does not.Expected Behavior
Either (a) my typing annotations are correct and mypy shouldn't report a problem with either function, or (b) my typing annotations are bogus and mypy should report a problem with both functions.
Actual Behavior
mypy produces the following error:
Your Environment
I've reproduced this both on the playground (mypy latest 1.2.0, Python 3.11, default options) and on my Debian testing box (mypy=1.0.1-1, python3.11=3.11.2-6, no command line options, no changes to out-of-the-box configuration).
The text was updated successfully, but these errors were encountered: