-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
For itertools.accumulate, erroneously: requires func
if initial
specified; allows initial
to be positional
#4888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looks almost right. It should be typeshed doesn't really do tests like that, see #1339 and #754 for some discussion. We run stubtest, which catches this issue but we've whitelisted the large backlog of errors while we whittle them down (a lot of progress has been made + this is an easy way to contribute to typeshed if you're looking!):
|
Yep - my motivating cases now work for me. Thanks very much @hauntsaninja and @srittau for getting this all sorted. Apologies I didn't respond sooner. |
Based on the documentation for the ≥3.8 version of itertools.accumulate, I'd expect this to be valid:
…and this to be invalid (due to
initial
being a keyword-only argument):…and this expectation is reflected by running it under Python 3.8.5. But mypy (0.782) rejects the former with:
…and accepts the latter. The above error disappears if
func
is specified.I'm a type-annotation novice, but it looks to me like this could be addressed with:
That seems to fix both issues for me. Does it look right?
I cloned the repo and started looking at the test setup, but I can't see: is there a way I can add testcases that reproduce the false positive and false negative that I'm aiming to fix?
The text was updated successfully, but these errors were encountered: