소스 검색

Eliminated repetitive replacement calls.

Sander Mathijs van Veen 14 년 전
부모
커밋
e567923a8c
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      line.py

+ 4 - 4
line.py

@@ -158,11 +158,11 @@ def generate_line(root):
             # Function call
             result = op + '(' + ', '.join(map(traverse, node)) + ')'
 
-        # An addition with negation can be written as a subtraction, e.g.:
-        # 1 + -2  ->  1 - 2
-        return result.replace('+ -', '- ')
+        return result
 
-    return traverse(root)
+    # An addition with negation can be written as a subtraction, e.g.:
+    # 1 + -2  ->  1 - 2
+    return traverse(root).replace('+ -', '- ')
 
 
 def is_negation(node):