Mathics
Mathics copied to clipboard
to_sympy(String) returns None; use repr for to_python()
in core/expression.py
:
class String(Atom):
...
def get_string_value(self) -> str:
return self.value
def to_sympy(self, **kwargs):
return None
def to_python(self, *args, **kwargs) -> str:
return '"%s"' % self.value # add quotes to distinguish from Symbols
to_sympy() should probably return self.value
. Also I think there shoudl be a parameter to to_python()
that indicates whether you want quotes or not. And to_python() is wrong since repr should be used to handle the fact that the string might have embedded quotes.