From 71adf2acf9e62a459ed530d430969f4b8758f2f7 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 25 Mar 2014 10:02:13 -0400 Subject: [PATCH] Defined __repr__ for tf/ss Makes display work for IPython. --- src/statesp.py | 4 ++++ src/xferfcn.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/statesp.py b/src/statesp.py index 96eb1dd40..c9343ebe9 100644 --- a/src/statesp.py +++ b/src/statesp.py @@ -12,6 +12,7 @@ StateSpace._remove_useless_states StateSpace.copy StateSpace.__str__ +StateSpace.__repr__ StateSpace.__neg__ StateSpace.__add__ StateSpace.__radd__ @@ -225,6 +226,9 @@ def __str__(self): str += "\ndt = " + self.dt.__str__() + "\n" return str + # represent as string, makes display work for IPython + __repr__ = __str__ + # Negation of a system def __neg__(self): """Negate a state space system.""" diff --git a/src/xferfcn.py b/src/xferfcn.py index b8fe721d7..d22b2a13b 100644 --- a/src/xferfcn.py +++ b/src/xferfcn.py @@ -12,6 +12,7 @@ TransferFunction._truncatecoeff TransferFunction.copy TransferFunction.__str__ +TransferFunction.__repr__ TransferFunction.__neg__ TransferFunction.__add__ TransferFunction.__radd__ @@ -316,6 +317,9 @@ def __str__(self, var=None): outstr += "\ndt = " + self.dt.__str__() + "\n" return outstr + + # represent as string, makes display work for IPython + __repr__ = __str__ def __neg__(self): """Negate a transfer function."""