bpo-35224: Add support for NamedExpr to unparse.py (GH-11670)

This commit is contained in:
Victor Stinner 2019-01-25 01:49:53 +01:00 committed by GitHub
parent 8f59ee01be
commit 1396d8fab4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)