Open elfring opened 3 years ago
It looks better! 👍
I propose to reconsider and improve also special string concatenations which can be found with the help of a search pattern like the following.
[Markus_Elfring@fedora guider]$ grep --perl-regexp --count "(\w+)\s*=\s*('|\")%s.*%s.*\2\s*%\s*\(\1,.+\)" guider.py
113
Example:
if SysMgr.lineLength > nowLen + len(nextCall):
- userCall = '%s%s' % (userCall, nextCall)
+ userCall += nextCall
nowLen += len(nextCall)
Would you like to adjust any more questionable data processing details? :thinking:
I agree with you! I'll fix them!
Would you like to use any development tools which can help a bit more to perform mass source code transformations? :thinking:
Yes, I would like to use those tools if I can use them. Could you recommend any tools?
Thanks for another source code improvement.
I guess that there are more remaining update candidates to consider according to the discussed transformation pattern.
Additional change suggestion:
else:
- userCall = '%s\n%s %s' % \
- (userCall, ' ' * indentLen, nextCall)
+ userCall += '\n%s %s' % (' ' * indentLen, nextCall)
nowLen = indentLen + len(nextCall)
Would you find development tools (like the following) helpful?
Yes, I would like to use those tools if I can use them.
Would you like to integrate anything from a source code 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]] = :[a] + :[[b]]' ':[a] += :[b]' $(find /home/altes_Heim2/elfring/Projekte/guider/lokal -name '*.py')
I checked this result :) some lines are wrong but other is useful :)
+++ guider.py
@@ -20727,12 +20727,12 @@
data2 = ord(source[count])
thisVal = data1*256 + data2
- sum = sum + thisVal
+ sum += thisVal
sum = sum & 0xffffffff # Necessary?
- count = count + 2
+ count += 2
if countTo < len(source):
- sum = sum + ord(source[len(source) - 1])
+ sum += ord(source[len(source) - 1])
sum = sum & 0xffffffff # Necessary?
sum = (sum >> 16) + (sum & 0xffff)
@@ -62803,7 +62803,7 @@
if sym.endswith(Debugger.RETSTR):
rsym = sym
else:
- rsym = sym + Debugger.RETSTR
+ rsym += Debugger.RETSTR
# add return stats #
if rsym in instance.callTable and \
@@ -67605,7 +67605,7 @@
struct.unpack('HHHHIII', target)
# get verdef strings #
- soffset = offset + vd_aux
+ soffset += vd_aux
for vidx in range(vd_cnt):
starget = verdef_section[soffset:soffset+sentsize]
vda_name, vda_next = \
@@ -67643,7 +67643,7 @@
struct.unpack('HHIII', target)
# get verneed strings #
- soffset = offset + entsize
+ soffset += entsize
for vidx in range(vn_cnt):
starget = verneed_section[soffset:soffset+entsize]
vna_hash, vna_flags, vna_other, vna_name, vna_next = \
some lines are wrong but other is useful
:thought_balloon: Would you like to integrate anything from a source code transformation result which can be generated also by a command like the following? (:point_right: Update candidates in 26 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 /home/altes_Heim2/elfring/Projekte/guider/lokal -name '*.py')
How do you think about to share insights for the evolution of run time characteristics (eventually also for a software component like “Sly Lex Yacc”) together with adjustments for discussed implementation details? :thinking:
:thought_balloon: Do any factors hinder the wider application of functionality which became generally available with Python 2?
I also like the augmented assignment expression :) I already applied it in manual and using your scripts.
I suggest to use an augmented assignment statement also at the following place in the function “getData” of the script “guider.py”.