- Notifications
You must be signed in to change notification settings - Fork3.8k
Add _GenericVector to math typestubs, fixes#3150
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.
LGTM 👍 Less duplication
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.
Typing is far too 🧠 for me right now, but this looks good as far as I can tell.
Thanks for working on this stuff Ankith!
ankith26 commentedAug 10, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Fixed merge conflicts in here. Was giving a final scroll and I noticed a few more typing issues |
illume left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Another idea of mine was to add GenericVector to C code itself
Yes, this would be nice.
There is also the Vec4 and Matrix to consider, and a VectorN would be useful (maybe just called Vector). What I'm getting at is perhaps we should plan where these are going. Personally I have need for matrix and larger vectors. Also there is the immutable discussion. We have the immutable discussion here:#2312 and I started an issue for Matrix and Vector4 here:#3412
With regard to type changes... I think we still have some work to do to make them more usable. Especially with testing changes are usable by humans. How do I type my pygame using function to take a ColorLike for example? How do we know type changes aren't breaking user programs? Can we automate more testing of types? Added an issue for this:#3411
A followup PR for#3088, after this PR typecheckers should handle return types of some methods of vector subclasses correctly.
While working on this I realised there was a lot of code repetition in the
VectorNstubs, so I added a_GenericVectorprivate superclass forVectorNthat implements the common methods of both vector objects.Another idea of mine was to add
GenericVectorto C code itself, user code should continue to useVectorNbut thisGenericVectorcould exist only to make the C implementation easier and exist as an ABC for vectors maybe? This would be new API and needs more discussion so is something for the future, this PR only affects the typestubs for now