mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.94k stars 562 forks source link

Increase the usage of augmented assignment statements #977

Closed elfring closed 2 years ago

elfring commented 3 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/pyodbc/lokal -name '*.py')

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

v-chojas commented 3 years ago

Feels like spam. pyODBC isn't even written in Python.

elfring commented 3 years ago

@v-chojas: How does your comment fit to the language statistic at the moment? Python: 63.5%

v-chojas commented 3 years ago

Did you look at the source? Does this look like Python to you? https://github.com/mkleehammer/pyodbc/tree/master/src

gordthompson commented 2 years ago

@elfring - Thanks for your suggestion, but the Python parts of pyodbc are really just the tests. There is no need to do any fancy optimization of them as long as they properly test the C++ code in pyodbc itself.