X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/236157f4861732617ec9078a4364464514bd5b4c..66e41ccd173874b3309e4c24be64c7b6b2ac6298:/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):