This adds one more commit on top of #848 and squashes the commits.
Thanks to @fchapoton for spotting the issue and suggesting initial fixes.
This adds one more commit on top of #848 and squashes the commits.
Thanks to @fchapoton for spotting the issue and suggesting initial fixes.
99 | @@ -100,7 +100,7 @@ class fastfrac: 100 | """Multiply something else with a fraction.""" 101 | return self.__mul__(other) 102 | 103 | - def __div__(self,other): 104 | + def __truediv__(self,other):
This breaks sage 8.9. Can you leave the originas __div__ definition (which shouldn't affect python 3) and add __truediv__? I tested that with this change both versions give the same output.
I can do this but I don't understand that this helps for sage 8.9 because it's based on python 2 and all the other changes should break it. So you're saying this works for you?
the changes about print, xrange and map are all harmless : they work with good old python2-based sage
Ok, I changed it.
110 | return NotImplemented 111 | 112 | + # Compatibility wrapper for Sage versions based on Python 2 113 | + def __div__(self,other): 114 | + """Divide two fractions.""" 115 | + return __truediv__(self,other)
NameError: global name '__truediv__' is not defined. This should be return self.__truediv__(other)
Ok, I assumed I'm clever enough to write three lines of Python code without testing. But apparently I was wrong. (Sorry, it's a lot of work for me to install an older sage version...) Should work now.
Fwiw, nix-shell -p sage would work but the tests take forever. Therefore you can use nix-shell '-p sage.overrideAttrs (oldAttrs: rec { buildInputs = [ makeWrapper ]; })' to disable the tests.
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
ACK 13c88efed0005eb6745a222963ee74564054eafb