More pythonic code

master
Salvo 'LtWorf' Tomaselli 2020-06-18 17:24:45 +07:00
parent dcde484a63
commit a74c17f323
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF
1 changed files with 1 additions and 4 deletions

@ -121,10 +121,7 @@ class Node:
def printtree(self, level: int = 0) -> str: def printtree(self, level: int = 0) -> str:
'''returns a representation of the tree using indentation''' '''returns a representation of the tree using indentation'''
r = '' r = ' ' * level + self.name
for i in range(level):
r += ' '
r += self.name
if self.name in b_operators and isinstance(self, Binary): if self.name in b_operators and isinstance(self, Binary):
r += self.left.printtree(level + 1) r += self.left.printtree(level + 1)
r += self.right.printtree(level + 1) r += self.right.printtree(level + 1)