Comment #12 on issue 1960 by Vinzent.Steinberg: should repr form of
geometry entities be the same as str?
http://code.google.com/p/sympy/issues/detail?id=1960
I think in sympy we have repr() == str(), because str([...]) uses repr() to
print all elements inside the list, which is usually not wanted for sympy
expressions. Hence repr(sympyobject) == str(sympyobject).
Sometimes you still want the eval()'able representation (you usually would
get with the built-in repr()), so you have to use srepr().
In [1]: e = sqrt(x - y**2)
In [2]: e # isympy pretty printing
Out[2]:
⎽⎽⎽⎽⎽⎽⎽⎽
╱ 2
╲╱ x - y
In [3]: str(e)
Out[3]: (x - y**2)**(1/2)
In [4]: repr(e)
Out[4]: (x - y**2)**(1/2)
In [5]: srepr(e)
Out[5]: Pow(Add(Symbol('x'), Mul(NegativeOne, Pow(Symbol('y'),
Integer(2)))), Half(1, 2))
In [6]: sstr(e)
Out[6]: (x - y**2)**(1/2)
In [7]: pretty(e)
Out[7]:
⎽⎽⎽⎽⎽⎽⎽⎽
╱ 2
╲╱ x - y
--
You received this message because you are subscribed to the Google Groups
"sympy-patches" group.
To post to this group, send email to sympy-patc...@googlegroups.com.
To unsubscribe from this group, send email to
sympy-patches+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-patches?hl=en.