Skip to content

Value not captured in YieldFrom #161

@JoshuaGlaZ

Description

@JoshuaGlaZ

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
... ... ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions