Closed L-P closed 12 years ago
Time.__div__
should get the same treatment but I could not get it to work :
It probably just needs a cast, I'll try to add it.
I have added __truediv__
in Time
. I also realized that your modification relies on the first argument to be self. This doesn't work with the way Cython does arithmetic operator overloading, see http://docs.cython.org/src/userguide/special_methods.html#arithmetic-methods. So I simply duplicated the old code of __div__
in __truediv__
. It also saves one runtime method call. (We could make it a C function, but then it would need to be far outside of the methods that call it.)
I had a little doubt about that, thanks.
Python3 does not use
__div__
but__floordiv__
and__truediv__
so expressions likesf.Vector2f(4, 2) / 7
raisedTypeError
exceptions. I did not implement__floordiv__
because it does not make much sense with a vector of floats.Time.__div__
should get the same treatment but I could not get it to work :Did not make much sense to me.