Ask Your Question
1

Use python as default data type

asked 2017-02-10 01:00:11 +0200

Pedro Martins gravatar image

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-10 05:28:58 +0200

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-12 01:03:48 +0200 )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-10 01:00:11 +0200

Seen: 103 times

Last updated: Feb 10 '17