[ https://issues.apache.org/jira/browse/BEAM-8280?focusedWorklogId=411411&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-411411 ]
ASF GitHub Bot logged work on BEAM-8280: ---------------------------------------- Author: ASF GitHub Bot Created on: 27/Mar/20 21:51 Start Date: 27/Mar/20 21:51 Worklog Time Spent: 10m Work Description: robertwb commented on pull request #11232: [BEAM-8280] Document Python 3 annotations support URL: https://github.com/apache/beam/pull/11232#discussion_r399554554 ########## 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: This should be the preferred way; put it first. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 411411) Time Spent: 11h 40m (was: 11.5h) > re-enable IOTypeHints.from_callable > ----------------------------------- > > Key: BEAM-8280 > URL: https://issues.apache.org/jira/browse/BEAM-8280 > Project: Beam > Issue Type: Bug > Components: sdk-py-core > Reporter: Udi Meiri > Assignee: Udi Meiri > Priority: Major > Time Spent: 11h 40m > Remaining Estimate: 0h > > See https://issues.apache.org/jira/browse/BEAM-8279 -- This message was sent by Atlassian Jira (v8.3.4#803005)