On Thu, 26 Nov 2009 02:51:17 -0800 (PST)
Nathann Cohen <nathann.co...@gmail.com> wrote:

> Hmmmmmm.... After thinking about it for a bit, is using var() really a
> good solution ? It is fast and everything, but I use my variables in
> functions that should not spoil the userspace with them ! When I
> define symbolic variables, they are global and could even be accessed
> in the userspace... Can this be avoided ?

If you're using Cython you can bypass the global symbol registry and
construct your symbols using pynac directly.

This untested function (based on sage.symbolic.ring.SymbolicRing.symbol)
might work:

    def my_symbol(name):
        cdef GSymbol symb
        GSymbol_construct_str(&symb, name)
        cdef Expression e
        e = <Expression>PY_NEW(Expression)
        GEx_construct_symbol(&e._gobj, symb)
        e._parent = SR
        return e

You need to include sage/libs/ginac/decl.pxi to get the declarations of
GSymbol, GSymbol_construct_str, etc.


Cheers,
Burcin

-- 
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