[ 
https://issues.apache.org/jira/browse/BEAM-5431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17123139#comment-17123139
 ] 

Beam JIRA Bot commented on BEAM-5431:
-------------------------------------

This issue is P2 but has been unassigned without any comment for 60 days so it 
has been labeled "stale-P2". If this issue is still affecting you, we care! 
Please comment and remove the label. Otherwise, in 14 days the issue will be 
moved to P3.

Please see https://beam.apache.org/contribute/jira-priorities/ for a detailed 
explanation of what these priorities mean.


> StarMap transform for Python SDK
> --------------------------------
>
>                 Key: BEAM-5431
>                 URL: https://issues.apache.org/jira/browse/BEAM-5431
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-py-core
>            Reporter: Stephan Hoyer
>            Priority: P2
>              Labels: stale-P2
>
> I'd like to propose a new high-level transform "StarMap" for the Python SDK. 
> The transform would be syntactic sugar for ParDo like Map, but would would 
> automatically unpack arguments like 
> [itertools.starmap|https://docs.python.org/3/library/itertools.html#itertools.starmap]
>  from Python's standard library.
> The use-case is to handle applying functions to tuples of arguments, which is 
> a common pattern when using Beam's combine and group-by transforms. Right 
> now, it's common to write functions with manual unpacking, e.g., 
> {code:java}
> def my_func(inputs):
>   key, value = inputs
>   ...
> beam.Map(my_func) {code}
> StarMap offers a much more readable alternative: 
> {code:java}
> def my_func(key, value):
>   ...
> beam.StarMap(my_func){code}
>  
> The need for StarMap is especially pressing with the advent of Python 3 
> support and the eventual wind-down of Python 2. Currently, it's common to 
> achieve this pattern using unpacking in a function definition, e.g., 
> beam.Map(lambda (k, v): my_func(k, v)), but this is invalid syntax in Python 
> 3. My internal search of Google's codebase turns up quite a few matches for 
> "beam\.Map(lambda\ (", none of which would work on Python 3.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to