From 63ce79d627837c96629fd9934ecd57afc1c2604a Mon Sep 17 00:00:00 2001 From: Tom Stepp Date: Tue, 17 May 2022 20:50:45 -0700 Subject: [PATCH] Add clarification on Filter transform's input function to pydoc. It was difficult to understand how to implement a function to pass to the Filter transform. I added a useful comment that was found in "https://beam.apache.org/documentation/transforms/python/elementwise/filter/". --- sdks/python/apache_beam/transforms/core.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdks/python/apache_beam/transforms/core.py b/sdks/python/apache_beam/transforms/core.py index 3fda87ebfcfc..b544c03c7442 100644 --- a/sdks/python/apache_beam/transforms/core.py +++ b/sdks/python/apache_beam/transforms/core.py @@ -2087,6 +2087,9 @@ def Filter(fn, *args, **kwargs): # pylint: disable=invalid-name """:func:`Filter` is a :func:`FlatMap` with its callable filtering out elements. + Filter accepts a function that keeps elements that return True, and filters + out the remaining elements. + Args: fn (``Callable[..., bool]``): a callable object. First argument will be an element.