MatrixManAtYrService opened a new issue #15813:
URL: https://github.com/apache/airflow/issues/15813


   **Description**
   
   https://github.com/apache/airflow/issues/8996 described the use of type 
hints to indicate multiple return values for functions decorated with `@task`. 
The `Dict` type hint was delivered in 
https://github.com/apache/airflow/pull/10349.  `Tuple` was left out of that PR 
(see 
[here](https://github.com/apache/airflow/pull/10349#issuecomment-680918458))
   
   I'm creating this issue so that we can discuss whether `Tuple` support 
should be added  as described 
[here](https://github.com/apache/airflow/pull/10349#issuecomment-674477268), or 
whether its omission from https://github.com/apache/airflow/pull/10349 means 
that it shouldn't be added at all.
   
   **The Argument**
   
   I think that its omission leaves the user in an awkward position.  The 
TaskFlow mindset extends very naturally to tuples:
   
   ```python
   @task
   def return_two() -> Tuple[str, int]:
       return "nine", 6
   
   @dag
   dag():
       a, b = return_two()
       print_one(a) 
       print_another(b)
   ```
   
   Without them you need extra object references to structure your dag.  You 
also need extra names to explicitly pull the xcoms that you implicitly pushed.  
I guess it would go something like this:
   
   ```python
   @task
   def return_two() -> Tuple[str, int]:
       return {"one": "nine", "another": 6}
   
   @dag
   def order():
   
       a = return_two()
       b = print_one("{{ ti.xcom_pull(key='one') }}")
       c = print_another("{{ ti.xcom_pull(key='another') }}")
   
       a >> b
       a >> c
   ```
   
   It just feels like it's coaxing you away from using TaskFlow, which is a 
bummer because TaskFlow is cool.


-- 
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]


Reply via email to