ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 03 Apr 2019 05:45:29 -0500"print" statement vs function for Sage-py3https://ask.sagemath.org/question/45994/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!Tue, 02 Apr 2019 15:56:46 -0500https://ask.sagemath.org/question/45994/print-statement-vs-function-for-sage-py3/Comment by Iguananaut for <p>With the upcoming migration of Sage from Python2 to Python3, I was wondering if Sage's default new behavior will be the current <code>print</code> statement (e.g., <code>print 'hello'</code>) or will it change to Python3's <code>print</code> command (e.g., <code>print('hello')</code>).</p>
<p>In case of a change from the current behavior, will there be a way to keep backwards compatibility for code written Python2-style?</p>
<p>Thanks for your answers!</p>
https://ask.sagemath.org/question/45994/print-statement-vs-function-for-sage-py3/?comment=45998#post-id-45998Personally, 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 add `from __future__ import print_function` to their sage startup profiles.Wed, 03 Apr 2019 05:45:29 -0500https://ask.sagemath.org/question/45994/print-statement-vs-function-for-sage-py3/?comment=45998#post-id-45998Comment by FrédéricC for <p>With the upcoming migration of Sage from Python2 to Python3, I was wondering if Sage's default new behavior will be the current <code>print</code> statement (e.g., <code>print 'hello'</code>) or will it change to Python3's <code>print</code> command (e.g., <code>print('hello')</code>).</p>
<p>In case of a change from the current behavior, will there be a way to keep backwards compatibility for code written Python2-style?</p>
<p>Thanks for your answers!</p>
https://ask.sagemath.org/question/45994/print-statement-vs-function-for-sage-py3/?comment=45997#post-id-45997My advice: start using python3 print right now.Wed, 03 Apr 2019 04:10:36 -0500https://ask.sagemath.org/question/45994/print-statement-vs-function-for-sage-py3/?comment=45997#post-id-45997Comment by John Palmieri for <p>With the upcoming migration of Sage from Python2 to Python3, I was wondering if Sage's default new behavior will be the current <code>print</code> statement (e.g., <code>print 'hello'</code>) or will it change to Python3's <code>print</code> command (e.g., <code>print('hello')</code>).</p>
<p>In case of a change from the current behavior, will there be a way to keep backwards compatibility for code written Python2-style?</p>
<p>Thanks for your answers!</p>
https://ask.sagemath.org/question/45994/print-statement-vs-function-for-sage-py3/?comment=45995#post-id-45995There is no resolution about this with respect to user code. It has been discussed at https://trac.sagemath.org/ticket/23674.Tue, 02 Apr 2019 17:58:25 -0500https://ask.sagemath.org/question/45994/print-statement-vs-function-for-sage-py3/?comment=45995#post-id-45995