History

scripts/show_delta: add __main__ judgement before main code

When doing Python programming it is a nice convention to insert the if statement `if __name__ == "__main__":` before any main code that does actual functionalities to ensure the code will be executed only as a script rather than as an imported module. Hence attach the missing judgement to show_delta.

Hu Haowen committed 3 years ago

Commit 94a03e11 parent 68279f91 file · +2 −1Browse files

Unified · Split

scripts/show_delta+2−1
@@ -125,4 +125,5 @@ def main(): · 124 unmodified lines
125 for line in lines:125 for line in lines:
126 print (convert_line(line, base_time),)126 print (convert_line(line, base_time),)
127 127
128main()128if __name__ == "__main__":
129 main()