Skip to content
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

Python 3 Compatibility for Vec3 #51

Merged
merged 2 commits into from
Mar 30, 2020
Merged

Conversation

Swiftloke
Copy link
Contributor

@Swiftloke Swiftloke commented Mar 27, 2020

This commit adds the __eq__ and __ne__ functions to the Vec3 class, enabling equal and not equal comparisons of the class in Python 3. Discussion should be had on support for __gt__, __lt__, __ge__, and __le__.

This commit adds the __eq__ and __ne__ functions to the Vec3 class, enabling comparisons of the class in Python 3.
@arpruss
Copy link
Owner

arpruss commented Mar 27, 2020

Why not just define eq as return self.x == rhs.x and self.y == rhs.y and self.z == rhs.z ?

@Swiftloke
Copy link
Contributor Author

Swiftloke commented Mar 30, 2020

There really is no reason why not, I suppose. I just copy/pasted the __cmp__ code from the Py2 implementation and made it work for Py3- I wasn't really sure if you would want the code to look similar.

@arpruss arpruss merged commit ccfe4be into arpruss:master Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants