DEAP / deap

Distributed Evolutionary Algorithms in Python
http://deap.readthedocs.org/
GNU Lesser General Public License v3.0
5.83k stars 1.13k forks source link

Increase the usage of augmented assignment statements #596

Open elfring opened 2 years ago

elfring commented 2 years ago

: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]$ perl -p -i.orig -0777 -e 's/^(?<indentation>\s+)(?<target>\S+)\s*=\s*\k<target>[ \t]*(?<operator>[+\-%&|^@]|\*\*?|\/\/?|<<|>>)/$+{indentation}$+{target} $+{operator}=/gm' $(find ~/Projekte/deap/lokal -name '*.py')

How do you think about to improve 14 source code places? :thinking:

fmder commented 2 years ago

As stated in the PR, some of these changes reduce readability compared to original mathematical equation. But you are right something like

g = g + 1

could easily be replaced by

g += 1
elfring commented 2 years ago

:thought_balloon: Will such software development concerns be adjusted any more?

fmder commented 2 years ago

If you look there is a devel branch integrating quite a lot of changes in the optic to release a 2.0 version.