X-Git-Url: https://scm.cri.mines-paristech.fr/git/linpy.git/blobdiff_plain/34bcb159c06a4725f7a2baaf5ddcc6dffd5d74fe..2b1e012ff2ad875e44e368bc37430ac5e5e97324:/pypol/linear.py?ds=sidebyside diff --git a/pypol/linear.py b/pypol/linear.py index 74b5477..b40415f 100644 --- a/pypol/linear.py +++ b/pypol/linear.py @@ -285,13 +285,7 @@ class Expression: return '({})'.format(string) def __repr__(self): - string = '{}({{'.format(self.__class__.__name__) - for i, (symbol, coefficient) in enumerate(self.coefficients()): - if i != 0: - string += ', ' - string += '{!r}: {!r}'.format(symbol, coefficient) - string += '}}, {!r})'.format(self.constant) - return string + return '{}({!r})'.format(self.__class__.__name__, str(self)) @_polymorphic_method def __eq__(self, other): @@ -673,7 +667,7 @@ class Polyhedron: constraints.append('{} == 0'.format(constraint)) for constraint in self.inequalities: constraints.append('{} >= 0'.format(constraint)) - return '{{{}}}'.format(', '.join(constraints)) + return '{}'.format(', '.join(constraints)) def __repr__(self): if self.isempty(): @@ -681,10 +675,7 @@ class Polyhedron: elif self.isuniverse(): return 'Universe' else: - equalities = list(self.equalities) - inequalities = list(self.inequalities) - return '{}(equalities={!r}, inequalities={!r})' \ - ''.format(self.__class__.__name__, equalities, inequalities) + return '{}({!r})'.format(self.__class__.__name__, str(self)) @classmethod def _fromsympy(cls, expr):