-
-
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
Merge Python 2 and 3 builtins.pyi #2533
Conversation
Resolve merge conflicts with builtins.py et al.
Looking at the merged stubs, I'm actually not quite sure if this is worth it. There are so many conditional definitions which make the merged stub harder to read, in my opinion. Stubs for builtins are read by users when they want to learn about how things are annotated (e.g. when subclassing a built-in type), so readability has an impact beyond maintainability. The longer stub will also slow down mypy runtimes slightly, since builtins needs to be always processed. This should only affect the first, non-incremental run, though. |
I still find the merged stubs to be well readable. In my opinion it is actually a big advantage that the differences between Python 2 and 3 are easy too see now. Also, I fixed two or three bugs in one version, but not the other while merging, since patches did not get applied to both versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this Herculean PR! I have two small comments.
I do think the change is worth it. Having a single copy of the stub makes maintenance significantly easier, so I'd almost always prefer a single stub file over two.
This merge conflicted again. I can merge it once it's fixed. |
Done, thanks for looking into this. Considering the amount of PRs we get for builtins, merging it will be helpful. :) |
It looks like it got messed up in #2533
It looks like it got messed up in #2533
It looks like it got messed up in python#2533
Part of #4
Note to reviewer: It probably makes sense to review the individual commits, especially the first one, since changes are easier to see.