You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/09/10 21:39:30 UTC
[GitHub] [airflow] Fokko commented on a change in pull request #6074:
[AIRFLOW-5390] Remove provide context
Fokko commented on a change in pull request #6074: [AIRFLOW-5390] Remove provide context
URL: https://github.com/apache/airflow/pull/6074#discussion_r322975018
##########
File path: docs/howto/operator/python.rst
##########
@@ -34,7 +34,8 @@ Passing in arguments
^^^^^^^^^^^^^^^^^^^^
Use the ``op_args`` and ``op_kwargs`` arguments to pass additional arguments
-to the Python callable.
+to the Python callable. If you use any of the :doc:`context variables <../../macros-ref>`
+as an argument of the provided callable, the value will be automatically injected as shown below:
Review comment:
I think the main goal was to simplify how it works, that you don't have to care about how this works as a user of Airflow. Besides that, I don't like the `**` notation:
```python
def myfunc(**context):
print(context['ds'])
```
is equivalent to:
```python
def myfunc(ds):
print(ds)
```
So I don't want to point the user in the direction of using an overly verbose way of doing this. Normally in Python you should also be conscious with the kwargs stuff.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services