On Thu, Apr 9, 2009 at 10:33 AM, Arnaud Bergeron <aberge...@gmail.com> wrote:
>
> 2009/4/7 Brian Granger <ellisonbg....@gmail.com>:
>>
>>> That seems awfully complicated.  How about (untested):
>>>
>>> sage_python = python
>>> from sympy import *
>>> python = sage_python
>>>
>>> or (even shorter, and still untested):
>>>
>>> from sympy import *
>>> restore('python')
>>
>> Sure these may work, but in my mind they are temporary hacks.
>>
>>> The %whatever syntax in the notebook works by calling the function
>>> "whatever" in the notebook process's current global scope.  I actually
>>> kind of like this design; it means you can easily add new handlers
>>> (for instance, you could define a function in one notebook cell and
>>> use it with the % syntax in the next cell).
>>
>> I understand why that choice was made, but as more and more modes are
>> added to the sage notebook, you are going to end up with really odd
>> side effects like this.  I think it is unreasonable to expect that
>> every possible python package that is ever used in Sage avoid all
>> names that conflict with Sage mode names.
>>
>> The killer is that for new users something that works perfectly in
>> python/ipython fails is Sage (from sympy import *).  In this case
>> debugging it was easy (the package was Sympy and Ondrej hangs out
>> around here).  What happens when someone finds this with some odd
>> package Foo that the Sage community has no connection with?
>>
>> I think Ondrej's idea of having a
>> sage.notebook.register_handler(myhandler) call to register a new mode
>> is a much cleaner idea.  You could even make a magic like:
>>
>> %register myhandler
>
> Or simply, to keep the existing simplicity, change %myhandler to call
> sage_myhandler and rename the existing ones.  There is very little
> probability of other projects using sage_<something> as a name.
>
> Note that I am a bit favourable to the register_handler idea though.
> Something tells me it is not a good idea to mix the interpretation
> environment and the interpreted environment.  Especially if it is only
> done for python and sage modes.  But since I am not proposing to do
> the work, I will not complain either way.

I am currently a bit swamped with other things, but it's on my todo to
get a useful notebook spkg package and I will also fix this, unless
someone else will do it earlier, which is very well possible. :)

Obviously, as you all pointed out, there are several ways to get this
fixed, so Iet's wait for William's or other sage devs opinions on this
one.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to