]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Simpler way to write reindent(), suggested by Raymond H.
authorGuido van Rossum <guido@python.org>
Thu, 6 Mar 2003 13:09:09 +0000 (13:09 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 6 Mar 2003 13:09:09 +0000 (13:09 +0000)
Lib/timeit.py

index 3d1f30024050908569f916a7638c127393c5bda5..4ed24dea764a4d6ae4660353a34c2d5810abbfc8 100644 (file)
@@ -84,7 +84,7 @@ def inner(number, timer):
 
 def reindent(src, indent):
     """Helper to reindent a multi-line statement."""
-    return ("\n" + " "*indent).join(src.split("\n"))
+    return src.replace("\n", "\n" + " "*indent)
 
 class Timer:
     """Class for timing execution speed of small code snippets.