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

ASF subversion and git services commented on AIRFLOW-4034:
----------------------------------------------------------

Commit afc81e4d70e23ccd493e7cb54c0d3709d9eb7fa5 in airflow's branch 
refs/heads/v1-10-stable from BasPH
[ https://gitbox.apache.org/repos/asf?p=airflow.git;h=afc81e4 ]

[AIRFLOW-4034] Remove unnecessary string formatting with **locals() (#4861)

**locals() is used a lot for string formatting. This is considered
bad programming practice.


> 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
>            Assignee: Bas Harenslak
>            Priority: Major
>             Fix For: 2.0.0
>
>
> 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)

Reply via email to