Yes overriding it would probably help I guess? But I can't do this within Python, right?
The application is optlang
, which is an optimization problem formulation language I've build on top of sympy and a generic solver interface to mathematical programming solvers (so far glpk and cplex). Sometimes I have to deal with quite large problems and I am hitting performance limits with sympy. csympy would probably be a good solution to this problem since I am not using any of the more fancy parts of sympy. interface.py
captures most of the sympy part if you want too take a look. The Variable
class should inherit from csympy.Symbol. I remember that I stumbled over a stackoverflow piece with a workaround in Cython but I can't find it right now (will keep looking). I am not familiar with Cython but I would get into it if this can be achieved with a reasonable amount of work (the stackoverflow solution looked quite lengthy). I also tried wrapping csympy.Symbol but I didn't get very far with this approach (don't remember why).