From b1007c317a093cba784bccb17d267fe6cd4c994d Mon Sep 17 00:00:00 2001 From: Kia <kia@special-circumstanc.es> Date: Mon, 24 Aug 2020 16:40:18 -0600 Subject: [PATCH] removed off-by-one that led to anomalous-looking tree prettyprinting --- python_arborist.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python_arborist.py b/python_arborist.py index fa3e9a4..af23d8b 100644 --- a/python_arborist.py +++ b/python_arborist.py @@ -23,11 +23,11 @@ class TreeNode: return str(hex_to_name(self.language_element)) + str(self.subnodes) -def walk_the_tree(tree, level = 1): +def walk_the_tree(tree, level = 0): if tree == None: return - print(" " * (level -1) + "|---" + hex_to_name(tree.language_element) + " with " + str(len(tree.subnodes)) + " subnodes") + print(" " * (level) + "|---" + hex_to_name(tree.language_element) + " with " + str(len(tree.subnodes)) + " subnodes") for subnode in tree.subnodes: walk_the_tree(subnode, level + 1) -- GitLab