Skip to content

Commit 2a7fc79

Browse files
committed
small fixes to AST str functions
1 parent bc65426 commit 2a7fc79

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def repr_Not(self):
289289

290290

291291
def str_UnaryOp(self):
292-
return str(self.op) + ' ' + str(self.operand)
292+
return str(self.op) + '(' + str(self.operand) + ')'
293293

294294

295295
UnaryOp.__str__ = str_UnaryOp
@@ -766,9 +766,9 @@ class Begin(expr):
766766
def __str__(self):
767767
indent()
768768
stmts = ''.join([str(s) for s in self.body])
769-
end = indent_stmt() + str(self.result)
769+
end = indent_stmt() + + 'produce ' + str(self.result)
770770
dedent()
771-
return 'begin:\n' + stmts + end
771+
return '{\n' + stmts + end + '}'
772772

773773

774774
@dataclass

0 commit comments

Comments
 (0)