From f4008b32c046612679436510ca5e294da01e1bb1 Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Fri, 17 Jan 2020 16:26:24 +0100 Subject: [PATCH] Print actual block contents in Conditional.{__repr__,__str__} --- pystencils/astnodes.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pystencils/astnodes.py b/pystencils/astnodes.py index a9c7c98f2..062d3687f 100644 --- a/pystencils/astnodes.py +++ b/pystencils/astnodes.py @@ -110,10 +110,17 @@ class Conditional(Node): return result def __str__(self): - return 'if:({!s}) '.format(self.condition_expr) + return self.__repr__() def __repr__(self): - return 'if:({!r}) '.format(self.condition_expr) + repr = 'if:({!r}) '.format(self.condition_expr) + if self.true_block: + repr += '\n\t{}) '.format(self.true_block) + if self.false_block: + repr = 'else: '.format(self.false_block) + repr += '\n\t{} '.format(self.false_block) + + return repr def replace_by_true_block(self): """Replaces the conditional by its True block""" -- GitLab