This is an automated email from the ASF dual-hosted git repository.

tvalentyn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new d9321d8cdb3 Recommend `yield from` for emitting elements from 
iterables. (#25893)
d9321d8cdb3 is described below

commit d9321d8cdb3cc7f22d716fdc62deab9ae5f3300a
Author: tvalentyn <[email protected]>
AuthorDate: Wed Mar 29 17:16:24 2023 -0700

    Recommend `yield from` for emitting elements from iterables. (#25893)
---
 website/www/site/content/en/documentation/programming-guide.md | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/website/www/site/content/en/documentation/programming-guide.md 
b/website/www/site/content/en/documentation/programming-guide.md
index eeda63211b6..fc259f9cb81 100644
--- a/website/www/site/content/en/documentation/programming-guide.md
+++ b/website/www/site/content/en/documentation/programming-guide.md
@@ -955,9 +955,10 @@ the actual processing logic. You don't need to manually 
extract the elements
 from the input collection; the Beam SDKs handle that for you. Your `process` 
method
 should accept an argument `element`, which is the input element, and return an
 iterable with its output values. You can accomplish this by emitting individual
-elements with `yield` statements. You can also use a `return` statement
-with an iterable, like a list or a generator. Don't mix `yield` and
-`return` statements in the same `process` method - this leads to [undefined 
behavior](https://github.com/apache/beam/issues/22969).
+elements with `yield` statements, and use `yield from` to emit all elements 
from
+an iterable, such as a list or a generator. Using `return` statement
+with an iterable is also acceptable as long as you don't mix `yield` and
+`return` statements in the same `process` method, since that leads to 
[incorrect behavior](https://github.com/apache/beam/issues/22969).
 {{< /paragraph >}}
 
 {{< paragraph class="language-go">}}

Reply via email to