You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Bas Harenslak (JIRA)" <ji...@apache.org> on 2019/03/07 08:32:00 UTC

[jira] [Created] (AIRFLOW-4034) Make string formatting explicit by removing locals()

Bas Harenslak created AIRFLOW-4034:
--------------------------------------

             Summary: Make string formatting explicit by removing locals()
                 Key: AIRFLOW-4034
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4034
             Project: Apache Airflow
          Issue Type: Improvement
            Reporter: Bas Harenslak


Best practice for Python is generally to write explicit and readable code. With this mindset, it's preferable to string format like this:
{code:java}
mystring = "{var1} {var2}".format(var1=myobject.something, var2=somethingelse){code}
Instead of:
{code:java}
mystring = "{var1} {var2}".format(**locals()){code}
Because it makes string formatting explicit and is readable to the reader of the code what variables are used in the string format.

So, I suggest to remove all **locals() string formatting.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)