On Thursday, January 9, 2020 at 6:45:50 PM UTC-5, David Roe wrote: > > I had a recent discussion asking if there are any good tools for porting > Sage code to Python 3. Given the recent discussion > <https://groups.google.com/forum/#!topic/sage-devel/vYlbnAwKATM> about > how long we support Python 2, it seems like one concrete step we can take > to help users is to provide some documentation for doing so. > > The first step would seem to be to update our FAQ > <https://doc.sagemath.org/html/en/faq/faq-usage.html#can-i-use-sagemath-with-python-3-x> > to > reflect the current status (and probably the outcome of the discussion > about how long we support Python 2), with a pointer to the relevant > <https://wiki.sagemath.org/Python3-compatible%20code> wiki > <https://wiki.sagemath.org/Python3-Switch> pages > <https://wiki.sagemath.org/Python3-user>. But I don't see any discussion > on those pages about using any of the tools for porting from Python 2 to > Python 3 on .sage files. Has anyone tried this yet? >
I've been doing a set of files by hand, and think it would be helpful for there to be info on where to look for guidance on some of the more subtle porting issues beyond print statements. Two examples I hit just now: * Any backslash LaTeX in strings intended for consumption elsewhere in Sage (via printing or MathJax, presumably) needs to be in a raw string, apparently. E.g. r"$5\equiv 2 (\text{mod }3)$" whereas before "$5\equiv 2 (\\text{mod }3)$" worked. * I had one usage of "map" which was wrong from a Python 3 point of view in the two ways not mentioned in the usual guides, e.g. see https://stackoverflow.com/questions/12015521/python-3-vs-python-2-map-behavior So this would be a good service to provide, as well as what can't be handled automatically with ease. Also note that such porting tools might possibly gag on some Sage non-Python syntax, e.g. f(x)=x^2 ? Just guessing there. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/bbb6a793-8396-4a23-ac3d-6eea14045514%40googlegroups.com.