arpruss / raspberryjammod

Raspberry Jam Mod - a Mod Forge Minecraft mod implementing most of Raspberry Juice/Pi API
http://www.instructables.com/id/Python-coding-for-Minecraft/
Other
354 stars 94 forks source link

Python 3 Compatibility for Vec3 #51

Closed Swiftloke closed 4 years ago

Swiftloke commented 4 years ago

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__.

arpruss commented 4 years ago

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

Swiftloke commented 4 years ago

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.