Increase the usage of augmented assignment statements
:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of augmented assignment statements accordingly.
Would you like to integrate anything from a transformation result which can be generated by a command like the following? (:point_right: Please check also for questionable change suggestions because of an evolving search pattern.)
[Markus_Elfring@fedora lokal]$ ./comby -diff ':[[a]] = :[[_]] + :[[b]]' ':[a] += :[b]' $(find ~/Projekte/SLY/lokal -name '*.py')
…
+++ /home/Markus_Elfring/Projekte/SLY/lokal/sly/yacc.py
@@ -1231,7 +1231,7 @@
lr_index = p.lr_index
j = state
while lr_index < p.len - 1:
- lr_index = lr_index + 1
+ lr_index += 1
t = p.prod[lr_index]
# Check to see if this symbol and state are a non-terminal transition
…
:thought_balloon: Would you like to apply a source code transformation result which can be generated also by a command like the following? (:point_right: Update candidates in 12 lines)
[Markus_Elfring@fedora lokal]$ perl -p -i.orig -0777 -e 's/^(?<indentation>\s+)(?<target>\S+)\s*=\s*\k<target>\s*(?<operator>[+\-%&|^@]|\*\*?|\/\/?|<<|>>)/$+{indentation}$+{target} $+{operator}=/gm' $(find ~/Projekte/SLY/lokal -name '*.py')
Does this make any different at all in SLY performance?
I guess that a corresponding run time difference would be measurable. Can you find further software fine-tuning desirable then? :thinking:
Why do these changes matter?
:thought_balloon: I suggest to reconsider your development concerns also according to information from the Python enhancement proposal 577 (from 2018-05-14).
Why does this matter?
Can you accept the explanation from the Python documentation (which you probably know already)?
“…
In the augmented version, x is only evaluated once. Also, when possible, the actual operation is performed in-place, meaning that rather than creating a new object and assigning that to the target, the old object is modified instead.
…”
:thought_balloon: Do you accordingly expect positive effects for the software run time characteristics?
@jpsnyder : :thought_balloon: Would you confirm that a synthetic version of the human mind can produce suggestions that are valid in the context of software development?