uranusjr commented on issue #24021:
URL: https://github.com/apache/airflow/issues/24021#issuecomment-1141516682

   An alternative to `expand_kwargs` is to overload `expand` like this:
   
   ```python
   # Assuming: vals_a=[1, 2], vals_b=[3, 4], vals_c=[5, 6]
   FooOperator.expand(a=vals_a, b=vals_b, c=vals_c)
   # FooOperator(a=1, b=3, c=5)
   # FooOperator(a=2, b=4, c=6)
   
   # Assuming: kwargs1=[{"a": 1, "b": 3}, {"a": 2, "b": 4}], kwargs2=[{"c": 5}, 
{"c": 6}]
   FooOperator.expand(kwargs1, kwargs2)
   # Same result as above!
   
   # This is an error; can't mix positional and keyword arguments in one call.
   FooOperator.expand(kwargs2, a=vals_a)
   ```
   
   This makes the syntax cleaner, but I’m not quite sure if it would be more 
confusing to users.


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to