robertwb commented on a change in pull request #11232: [BEAM-8280] Document
Python 3 annotations support
URL: https://github.com/apache/beam/pull/11232#discussion_r399554700
##########
File path: website/src/documentation/sdks/python-type-safety.md
##########
@@ -64,22 +84,75 @@ To specify type hints as properties of a `DoFn` or
`PTransform`, use the decorat
The following code declares an `int` type hint on `FilterEvensDoFn`, using the
decorator `@with_input_types()`.
+```py
+{% github_sample
/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/snippets_test.py
tag:type_hints_do_fn %}
```
-{% github_sample
/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/snippets_test.py
tag:type_hints_do_fn %}```
Decorators receive an arbitrary number of positional and/or keyword arguments,
typically interpreted in the context of the function they're wrapping.
Generally the first argument is a type hint for the main input, and additional
arguments are type hints for side inputs.
-### Defining Generic Types
+### Declaring Type Hints Using Annotations
Review comment:
"Declaring Type Hints Using Type Annotations" (might be a bit redundant, but
is clearer).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services