Skip to content

Commit b30b3a9

Browse files
authored
Merge pull request #628 from jeverink/geometry-printing
Update printing for geometry
2 parents 6ac1f10 + 7850e30 commit b30b3a9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cuqi/geometry/_geometry.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,12 @@ def __eq__(self, obj):
225225
return self._all_values_equal(obj)
226226

227227
def __repr__(self) -> str:
228-
return "{}{}".format(self.__class__.__name__,self.par_shape)
228+
if self.par_shape == self.fun_shape:
229+
return "{}[{}]".format(self.__class__.__name__,
230+
self.par_shape if len(self.par_shape) != 1 else self.par_shape[0])
231+
return "{}[{}: {}]".format(self.__class__.__name__,
232+
self.par_shape if len(self.par_shape) != 1 else self.par_shape[0],
233+
self.fun_shape if len(self.fun_shape) != 1 else self.fun_shape[0])
229234

230235
def _all_values_equal(self, obj):
231236
"""Returns true of all values of the object and self are equal"""

0 commit comments

Comments
 (0)