[
https://issues.apache.org/jira/browse/BEAM-7746?focusedWorklogId=282365&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-282365
]
ASF GitHub Bot logged work on BEAM-7746:
----------------------------------------
Author: ASF GitHub Bot
Created on: 25/Jul/19 00:48
Start Date: 25/Jul/19 00:48
Worklog Time Spent: 10m
Work Description: udim commented on issue #9056: [BEAM-7746] Add python
type hints
URL: https://github.com/apache/beam/pull/9056#issuecomment-514851409
> Are the following two examples functionally equivalent in beam?
>
> ```python
> coll = pipe | core.Map(lambda _, x: x.do_stuff(), self.thing)
> ```
>
> ```python
> coll = pipe | core.Map(lambda _, x=self.thing: x.do_stuff())
> ```
>
Here's my attempt at recreating what Beam does:
```
>>> import dill
>>> o = object()
>>> l = lambda x=o: x
>>> l_loaded = dill.loads(dill.dumps(l))
>>> l() == l_loaded()
False
>>> l() == l_loaded(o)
True
```
Passing self.thing as a default argument causes it to get pickled with the
lambda and makes it a distinct object after unpickling.
I'm not sure thought what pickling the enclosing scope would do.
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 282365)
Time Spent: 5h 40m (was: 5.5h)
> Add type hints to python code
> -----------------------------
>
> Key: BEAM-7746
> URL: https://issues.apache.org/jira/browse/BEAM-7746
> Project: Beam
> Issue Type: New Feature
> Components: sdk-py-core
> Reporter: Chad Dombrova
> Assignee: Chad Dombrova
> Priority: Major
> Time Spent: 5h 40m
> Remaining Estimate: 0h
>
> As a developer of the beam source code, I would like the code to use pep484
> type hints so that I can clearly see what types are required, get completion
> in my IDE, and enforce code correctness via a static analyzer like mypy.
> This may be considered a precursor to BEAM-7060
> Work has been started here: [https://github.com/apache/beam/pull/9056]
>
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)