Can `@op`s be generators?
# ask-community
a
Can `@op`s be generators?
o
hi @Alexander Whillas! ops can be generators, although anything yielded from the op will need to be a valid Dagster event type (listed here). For example, if you have multiple outputs you want to yield from the body of your op, that would look like:
Copy code
from dagster import Output, op


@op(out={"out1": Out(str), "out2": Out(int)})
def my_op_yields():
    yield Output(5, output_name="out2")
    yield Output("foo", output_name="out1")
(example taken from here)
👍 1
a
thanks mate