I am writing a package (I want to use "import" to import it into sage).
I found that in the package (say, test.py), if I write
from sage.all import *
def test():
var('a')
print -1/2, -a/2, (-1/2)*a
and in sage type
import test; test.test()
I got "-1 -1/2*a -a"
This is different from directly run the above commands from sage.
I know in python 2, -1/2 returns -1. But is there a way to write "minus one half" (-1/2) in a package, say, test.py?
I know I could use load or attach. However, they don't have namespace and I hope to have namespace as in python.
To summarize, in this case, how to write -1/2 in test.py? Or is there a way to load a sage package with namespace? Thanks!