Ask Your Question
0

Use python as default data type

asked 2017-02-09 18:00:11 -0600

Hello everyone, The problem is the following: In a couple of modules I developed I check the object of the arguments. Since I am using this functions in a sage worksheet and Sagemath converts the integers I write in the worksheet to sagemath integers, my code always raises an exception in my python modules.

Can I use some directive or macro to make sage use python types by default? Another workaround is welcome!

Thanks in advance for the help, Pedro Martins

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-02-09 22:28:58 -0600

nbruin gravatar image

You can turn the preparser off:

preparser(False)

Or, if you want a more limited effect, you can see how integers get preparsed:

sage: preparse("10")
'Integer(10)'

and adapt that:

Integer=int
edit flag offensive delete link more

Comments

Thanks!! Exactly what I needed!

Pedro Martins gravatar imagePedro Martins ( 2017-02-11 18:03:48 -0600 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2017-02-09 18:00:11 -0600

Seen: 26 times

Last updated: Feb 09