I am using PyCharm (version 4.0.3) and I get a warning about the style. The assignment can be replaced by the extended assignment in the second line of the following code *:
abc = 'and cheese' abc = 'ham' + abc
* - My code is not really this code, but it generates the same error. I programmatically generate two lines, and I should / would like to create the first line (second part of the English syntax) before the second line (first part of the English syntax).
But I do not know that such an extended task could do this. If the code was like this (where the first part of the desired end string can be generated first in execution order)
abc = 'ham' abc = abc + 'and cheese'
then I believe that the problem is trivially resolved using the + operator:
abc = 'ham' abc += 'and cheese'
But in the context of my problem (where the “and cheese” part is declared before the “ham”), is there a way to satisfy this warning?
source share