On Wed, Dec 23, 2009 at 2:31 PM, Nicolas M. Thiery <nicolas.thi...@u-psud.fr> wrote: > On Wed, Dec 23, 2009 at 02:01:22PM -0800, William Stein wrote: >> > I stumbled recently into a nifty feature of the IPython interpreter >> > allowing for easy manipulations of the global namespace of the >> > interpreter, at the python level. Thanks to it, one can now do: >> > >> > sage: S = SymmetricFunctions(ZZ) >> > sage: S.import_shorthands() >> > sage: s[1] + e[2] * p[1,1] + 2*h[3] + m[2,1] >> > s[1] - 2*s[1, 1, 1] + s[1, 1, 1, 1] + s[2, 1] + 2*s[2, 1, 1] + s[2, 2] >> > + 2*s[3] + s[3, 1] >> > sage: s >> > Symmetric Function Algebra over Integer Ring, Schur symmetric functions >> > as basis >> > sage: e >> > Symmetric Function Algebra over Integer Ring, Elementary symmetric >> > functions as basis >> > ... >> >> What happens in the notebook (which in no way uses IPython)? Does it >> at least fail gracefully? > > Good point. I am using that seldom the notebook that I did not even > think about it :-) Let me try ... Ok, as I expected, it's not that graceful: > > Traceback (click to the left for traceback) > ... > AttributeError: 'NoneType' object has no attribute 'to_user_ns' > > Is there an easy way to manipulate the global namespace for the > notebook? For IPython, I am using:
No, not exactly. The notebook is just pure Python (right now). That said, from *Cython* you can get at the true global namespace by using the command globals(). See sage/sage/ext/interactive_constructors_c.pyx for code that does this sort of thing, which works uniformly in both IPython, pure python, and the notebook. William -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-de...@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.