mirror of https://github.com/python/cpython
Simpler way to write reindent(), suggested by Raymond H.
This commit is contained in:
parent
259d3d5784
commit
e05dcce686
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue