Ask Your Question

Use python as default data type

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

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

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

nbruin gravatar image

You can turn the preparser off:


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

sage: preparse("10")

and adapt that:

edit flag offensive delete link more


Thanks!! Exactly what I needed!

Pedro Martins gravatar imagePedro Martins ( 2017-02-11 18:03:48 -0500 )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


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

Seen: 25 times

Last updated: Feb 09