Is it possible to update the Sage Python?

asked 2017-04-05 16:13:53 -0500

cybervigilante gravatar image

updated 2017-04-06 00:58:12 -0500

FrédéricC gravatar image

I noticed Sage can run a Python notebook, but it's 2.7 when I'm used to using 3.x. It is possible to update the Python in Sage? Also I'm on Windows so I'm using the Sage Virtualbox appliance, which might make it impossible. But is it possible in a sage native host like Linux?

edit retag flag offensive close merge delete

Comments

Not yet. Sage is on track to switch to Python 3 - see e.g. https://trac.sagemath.org/ticket/15980

kcrisman gravatar imagekcrisman ( 2017-04-05 20:04:14 -0500 )edit

A possibility would be to import "things" from the future .

python-future.org/imports.html

docs.python.org/3/library/__future__.html

...stack over post....

For instance:

sage: from __future__ import absolute_import, print_function    # , division # but this is ok in sage
sage: type(print)
<type 'builtin_function_or_method'>
sage: print 1,2,3
  File "<ipython-input-117-e0b3713317fc>", line 1
    print Integer(1),Integer(2),Integer(3)
                ^
SyntaxError: invalid syntax

sage: print( 1,2,3 )
1 2 3
dan_fulea gravatar imagedan_fulea ( 2017-04-20 15:19:31 -0500 )edit