Skip to content

Commit

Permalink
bpo-35224: Add support for NamedExpr to unparse.py (pythonGH-11670)
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner authored Jan 25, 2019
1 parent 8f59ee0 commit 1396d8f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Tools/parser/unparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ def _Expr(self, tree):
self.fill()
self.dispatch(tree.value)

def _NamedExpr(self, tree):
self.write("(")
self.dispatch(tree.target)
self.write(" := ")
self.dispatch(tree.value)
self.write(")")

def _Import(self, t):
self.fill("import ")
interleave(lambda: self.write(", "), self.dispatch, t.names)
Expand Down

0 comments on commit 1396d8f

Please sign in to comment.