#16077: Python 3 preparation: Handle changes to "raw_input()" and "input()"
-------------------------------------+-------------------------------------
       Reporter:  wluebbe            |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.8
      Component:  distribution       |   Resolution:
       Keywords:  python3            |    Merged in:
        Authors:  André Apitzsch     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/aapitzsch/ticket/16077           |  ebbb5451fd9880273f7138bcb517c11b68a5badb
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by wluebbe):

 Instead of
 {{{
 +import six
 ...
 ...
 -            line = raw_input()
 +            line = six.moves.input()
 }}}
 I would prefer
 {{{
 +from six.moves import input
 ...
 ...
 -            line = raw_input()
 +            line = input()
 }}}
 The reasoning is
 * I see the goal as not only to enable Sage for Python 2 AND 3 but by
 writing '''clean Python 3 code that is backwards compatible with Python
 2'''.
 * Usage of compatibility libraries like {{{six}}} (or {{{future}}}) should
 appear (if possible) only at the top of a module. The rest of the module
 should have only pure Python 3 code.
 * This will ease the cleaning of the code when somewhere in the (far)
 future Python 2 support will be dropped.
 * We will have to explain in the documentation how the write Python 3 code
 in Sage while maintaining compatibility with Python 2. And it would by
 very helpful to have automated checks ...
 By the way all tests pass :-)

--
Ticket URL: <http://trac.sagemath.org/ticket/16077#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to