First time here? Check out the FAQ!

Ask Your Question
1

Interpreting ints as ints

asked 13 years ago

kartikv gravatar image

I am working with a python package called Theano, which has a function called "function" which basically takes in the symbolic representation of a function and compiles it for fast execution on a block of memory either on a CPU or a GPU. When trying to use it in sage, however, it gets a bit flummoxed by the fact that integers and such are interpreted as sage integers, rather than python basic types. Is there a way to (at runtime) turn off that part of the interpreter, so that code doesn't have to be rewritten to work in sage?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 13 years ago

Jason Grout gravatar image

updated 13 years ago

You can turn off the preparser altogether:

sage: type(1)
<type 'sage.rings.integer.Integer'>
sage: preparser(False)
sage: type(1)
<type 'int'>

If you are running sage on a .py file, it should not preparse the file. If it is a .sage file, then preparsing happens by default (but you can turn it off like above, I think).

Preview: (hide)
link

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

Seen: 322 times

Last updated: Jan 23 '12