Hi,

I was wondering - recently I read one blog post where author was using
PyLab from notebook by importing it into namespace (from pylab import
*) and overwriting lots of things like var and plot - together 75
names:

sage: import pylab
sage: len(filter(vars().has_key, pylab.__dict__.keys()))
75

making it hard to use normal Sage - yet it was worth the price...
PyLab seems to be used in lots of classes too as Matlab replacement
and there are lots of tutorials around. One could do "sage -ipython
-pylab", but then it's harder to setup the view - and it looks nicer
in notebook. So, to loosely adapt sample from SciPy tutorial, one
could already do:

import pylab
a=pylab.zeros(1000)
a[:100]=1
b=pylab.fft(a)
pylab.figure()
pylab.grid(True)
pylab.plot(abs(b))
pylab.savefig('.')

but it needs those names, even if we "import pylab as p", it's still 2
extra characters per pylab function. But - I though that it would be
cool if we had

%pylab (or %sagelab maybe? some functions might work a bit differently
than with pure PyLab)
a=zeros(1000)
a[:100]=1
b=fft(a)
figure()
grid(True)
plot(abs(b))
show()

do exactly the same, without overwriting the names with definitions
from outside of given cell other than what is defined inside it, i.e.
a and b in this example. What do you think? Does it makes some sense
to have %pylab/sagelab cells? I ask because I'd be willing to give it
a try, if I have enough spare time on my hands - I think it's doable
in finite time with only a bit of preparsing - at least it seems so to
me right now.

Cheers,
Andrzej.

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

Reply via email to