On Thu, Mar 26, 2009 at 11:05 AM, [email protected]
<[email protected]> wrote:
>
> Should I think of a Sage session as an IPython session with a lot of
> math related modules loaded into the namespace?

Yes.

>
> (i.e. I assume in the Sage shell init file somewhere there are lots of
> lines like this....?
>                 from some_math_stuff import * ?? )


There is a file somewhere that has

   from sage.all import *

in it.

>
> ----------------
> If yes, how can Sage be "just" an IPython session when the type of
> ints has changed?...
>
> e.g.
> sage: type(3)
> <type 'sage.rings.integer.Integer'>
>
> I'm impressed and intrigued that such a low level change was made to
> Python/IPython while still allowing Python code to interact with
> Sage.

We didn't touch Python or IPython directly.  Instead we use an
officially supported hook in IPython to preparse each input line
before it is sent to the Python interpreter.  When you type "type(3)",
Python sees 'type(Integer(3))'.

sage: preparse('type(3)')
'type(Integer(3))'

By the way, if you type

  sage -ipython
  In [1]: from sage.all import *
  In [2]

then you get a standard IPython session without preparsing:
 In [4]: type(3)
 Out[4]: <type 'int'>


> I would have thought such low level changes would have caused
> conflicts with Python code.

You're wrong, since it doesn't.

>
> Chris
>
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to