[Python-checkins] bpo-35224: Add support for NamedExpr to unparse.py (GH-11670)
Victor Stinner
webhook-mailer at python.org
Thu Jan 24 19:50:10 EST 2019
https://github.com/python/cpython/commit/1396d8fab4d0ae830d45f4937322bbb43ce0c30e
commit: 1396d8fab4d0ae830d45f4937322bbb43ce0c30e
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-01-25T01:49:53+01:00
summary:
bpo-35224: Add support for NamedExpr to unparse.py (GH-11670)
files:
M Tools/parser/unparse.py
diff --git a/Tools/parser/unparse.py b/Tools/parser/unparse.py
index 82c3c7768072..70b47a174053 100644
--- a/Tools/parser/unparse.py
+++ b/Tools/parser/unparse.py
@@ -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)
More information about the Python-checkins
mailing list