Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value not captured in YieldFrom #161

Open
JoshuaGlaZ opened this issue Jun 28, 2024 · 0 comments
Open

Value not captured in YieldFrom #161

JoshuaGlaZ opened this issue Jun 28, 2024 · 0 comments

Comments

@JoshuaGlaZ
Copy link
Contributor

YieldFrom (yield_from) statements in noworkflow do not capture the value.

yield from range(5)
name type composition_type
yield from range(5) expr value
yield from range(5) yield_from

Unlike yield_from, the yield statement captures the value

yield i
name type composition_type
yield i expr value
yield i yield value
i name

Similar to yield, yield_from should captures the value, as demonstrated in the example below using ast.dump:

Module(
  body=[
    Expr(
      value=YieldFrom(
        value=Call(
          func=Name(id='range', ctx=Load()),
          args=[
            Constant(value=5)],
          keywords=[])))],
  type_ignores=[])

In noworkflow, the equivalent result should be:

name type composition_type
yield from range(5) expr value
yield from range(5) yield_from value
range(5) call *args
... ... ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants