From 021204af1327851aa6289096d450295ffc0e4282 Mon Sep 17 00:00:00 2001 From: gilch Date: Wed, 23 Aug 2017 13:18:27 -0600 Subject: [PATCH] make HyCons __repr__ iterative --- hy/models.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hy/models.py b/hy/models.py index 14eb5eb..4866734 100644 --- a/hy/models.py +++ b/hy/models.py @@ -63,7 +63,7 @@ def replace_hy_obj(obj, other): def repr_indent(obj): - return repr(obj).replace('\n','\n ') + return repr(obj).replace("\n", "\n ") class HyString(HyObject, str_type): @@ -226,7 +226,7 @@ class HyList(HyObject, list): if self: return "%s([\n %s])" % ( self.__class__.__name__, - ",\n ".join([repr_indent(x) for x in self])) + ",\n ".join([repr_indent(e) for e in self])) else: return self.__class__.__name__ + "()" @@ -352,14 +352,14 @@ class HyCons(HyObject): HyObject.replace(self, other) def __repr__(self): - if isinstance(self.cdr, self.__class__): - return "" % ( - repr(self.car).replace('\n', '\n '), - repr(self.cdr).replace('\n', '\n ')) + lines = ["" % (repr_indent(self.cdr),)) + return '\n'.join(lines) def __eq__(self, other): return (