diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2014-03-02 12:07:33 +0200 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2014-03-02 12:07:33 +0200 |
| commit | 2e0df240db0cf677b0821371af7c2dfc021452ab (patch) | |
| tree | dceb3a67c05a44221177473b682b979359a736c0 /as_string.py | |
| parent | 8506cd2a4577bd0a2a6cdff412201c628912c8d1 (diff) | |
| download | astroid-git-2e0df240db0cf677b0821371af7c2dfc021452ab.tar.gz | |
Add yield_from property for Yield nodes.
--HG--
branch : yield_from
Diffstat (limited to 'as_string.py')
| -rw-r--r-- | as_string.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/as_string.py b/as_string.py index 72c5b6c3..1863b937 100644 --- a/as_string.py +++ b/as_string.py @@ -429,7 +429,11 @@ class AsStringVisitor(object): def visit_yield(self, node): """yield an ast.Yield node as string""" yi_val = node.value and (" " + node.value.accept(self)) or "" - expr = 'yield' + yi_val + if node.yield_from: + yield_ = 'yield from' + else: + yield_ = 'yield' + expr = yield_ + yi_val if node.parent.is_statement: return expr else: |
