Mon 2017-08-28 10:45:23 UTC, Nicolas M. Thiéry:
> About the book and Python 3
>
> [...]
>
> Problem
>
> A dozen of our "print" are of the form "print(a,b)". In this case, the
> output differs between Python 2 and Python 3, which is annoying: we
> would like our examples to work with the current Sage. One workaround
> would be to use instead:
>
> print("%s %s"%(a,b))
>
> but that's really heavy handed. We could also prefix each such print
> with a:
>
> from __future__ import print_function
>
> and explain once to the reader that this is a way to write code that
> works for both Python 2 and Python 3. Feasible, but this adds a bit of
> complexity for the user.
>
> Better suggestion anyone? What's the plan for the similar issue with
> Sage's own doc?
One possible workaround would be
print((a, b))
which would give the same result in Python 2 or Python 3.
The drawback would be the extra parentheses and commas in the output
but the input would remain easy to read.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.