Ask Your Question
1

Use python as default data type

asked 8 years ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 8 years ago

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
Preview: (hide)
link

Comments

Thanks!! Exactly what I needed!

Pedro Martins gravatar imagePedro Martins ( 8 years ago )

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: 8 years ago

Seen: 144 times

Last updated: Feb 10 '17