-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
stdlib: add overloads for itertools.product() up to an arity of 15 #13492
base: main
Are you sure you want to change the base?
Conversation
Before this change, the maximum usable arity for itertools.product() was 10 (increased in 2e83e65, python#12023, which raised it from 6 to 10). Fixes python#13490, albeit partially: just based on this change, a user has no way of knowing if he is hitting this limit or not. This discoverability problem will probably be best addressed with changes in documentation or in the type checkers.
163748f
to
4e69fa4
Compare
This comment has been minimized.
This comment has been minimized.
4e69fa4
to
7684a23
Compare
Thanks for catching the typo in the PR, @AlexWaygood. The same error was in the commit message. I have force-pushed a new version with the correct commit message. |
Thanks! Though we squash-merge all PRs, so it would have taken the PR title rather than the title of the commit anyway :-) |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
I'd rather not do this, actually—we can keep adding more overloads for this sort of thing without an obvious limit. The stubs become harder to understand and probably slower to process, error messages become harder to understand, etc. 10 seems like a good round number to stick with. |
Hi @JelleZijlstra, I understand your point of view: increasing the number of hardcoded overloads seems akin to putting Please, also consider that this request is coming form a user that is trying to use type hinting on actual code. Calling Probably not many users would bother debugging and reporting these sort of problems, so please consider that the amount of communication that reaches the maintainers may be less than the actual users' need. On a technical level, is there a way I can help to address your concerns?
If you want some modifications to the PR (comments? tests?) I'd be happy to make them. I also think that, later, there could be a followup for trying to generate proper unambiguous error messages for pathological cases. Let me know your opinion, thanks. |
Before this change, the maximum usable arity for
itertools.product()
was 10 (increased in 2e83e65, #12023, which raised it from 6 to 10).Fixes #13490, albeit partially: just based on this change, a user has no way of knowing if he is hitting this limit or not.
This discoverability problem will probably be best addressed with changes in documentation or in the type checkers.