
![]() | ``Pretty print'':
class StringFunction:
...
def __str__(self):
return self._f # just the string formula
|
![]() | Reconstruction: a = eval(repr(a))
# StringFunction('1+x+a*y',
independent_variables=('x','y'),
a=1)
def __repr__(self):
kwargs = ', '.join(['%s=%s' % (key, repr(value)) \
for key, value in self._prms.items()])
return "StringFunction1(%s, independent_variable=%s"
", %s)" % (repr(self._f), repr(self._var), kwargs)
|