diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-01-25 00:49:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-25 00:49:53 (GMT) |
commit | 1396d8fab4d0ae830d45f4937322bbb43ce0c30e (patch) | |
tree | e9f5fda66ef593b496da58b3a0bb1381b00d1544 /Tools | |
parent | 8f59ee01be3d83d5513a9a3f654a237d77d80d9a (diff) | |
download | cpython-1396d8fab4d0ae830d45f4937322bbb43ce0c30e.zip cpython-1396d8fab4d0ae830d45f4937322bbb43ce0c30e.tar.gz cpython-1396d8fab4d0ae830d45f4937322bbb43ce0c30e.tar.bz2 |
bpo-35224: Add support for NamedExpr to unparse.py (GH-11670)
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/parser/unparse.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Tools/parser/unparse.py b/Tools/parser/unparse.py index 82c3c77..70b47a1 100644 --- a/Tools/parser/unparse.py +++ b/Tools/parser/unparse.py @@ -79,6 +79,13 @@ class Unparser: 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) |