diff --git a/sdks/python/apache_beam/transforms/core.py b/sdks/python/apache_beam/transforms/core.py index 69c003ee5b8c..702274567d1b 100644 --- a/sdks/python/apache_beam/transforms/core.py +++ b/sdks/python/apache_beam/transforms/core.py @@ -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