First time here? Check out the FAQ!

Ask Your Question
0

How does sagemath modify python?

asked 7 years ago

screened00 gravatar image

type(3) <type 'sage.rings.integer.Integer'>

So how was sage's python version created, and do I need to learn C to be able to do that ? I would like some easy to begin guide, on how to achienve the same basic things as I'd like to know it's internal workings.

Preview: (hide)

Comments

You definitely don't need to learn C!

kcrisman gravatar imagekcrisman ( 7 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 7 years ago

eric_g gravatar image

Sage is indeed preparsing the entries before sending them to Python. To know what Sage is doing exactly with what you are typing, use the command preparse, with your Sage command passed as a string:

sage: preparse("3")
'Integer(3)'
sage: preparse("3+2")
'Integer(3)+Integer(2)'
sage: preparse("x^2")
'x**Integer(2)'
Preview: (hide)
link

Comments

Yes. And beyond the preparsing and adding lots of functions, there are a few other things that are (slightly) redefined like sum which expand their usefulness. For 99% of purposes Sage can be thought of as Python with extra sugar.

kcrisman gravatar imagekcrisman ( 7 years ago )
1

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 7 years ago

Seen: 343 times

Last updated: Jul 13 '17