"print" statement vs function for Sage-py3
With the upcoming migration of Sage from Python2 to Python3, I was wondering if Sage's default new behavior will be the current print
statement (e.g., print 'hello'
) or will it change to Python3's print
command (e.g., print('hello')
).
In case of a change from the current behavior, will there be a way to keep backwards compatibility for code written Python2-style?
Thanks for your answers!
There is no resolution about this with respect to user code. It has been discussed at https://trac.sagemath.org/ticket/23674.
My advice: start using python3 print right now.
Personally, I think we should change to using the
print
function by default on Python 2 as well, but it's hard to make that change without at least slightly breaking users' code. Perhaps we could start issuing a warning and tell users that they should addfrom __future__ import print_function
to their sage startup profiles.