Skip to content

Commit

Permalink
Improve Iterator error message (#23972)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNeuralBit authored Nov 4, 2022
1 parent 7da182a commit 1563b97
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sdks/python/apache_beam/transforms/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,9 @@ def _get_element_type_from_return_annotation(method, input_type):
else:
raise TypeError(
"Expected Iterator in return type annotation for "
f"{method!r}, did you mean Iterator[{return_type}]?")
f"{method!r}, did you mean Iterator[{return_type}]? Note Beam DoFn "
"process and process_batch methods are expected to produce "
"generators - they should 'yield' rather than 'return'.")

def get_output_batch_type(
self, input_element_type
Expand Down

0 comments on commit 1563b97

Please sign in to comment.