Skip to content

Commit 199d237

Browse files
committed
minor faster filtering using list comprehension
1 parent 3ab30a7 commit 199d237

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/textwrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def dedent(text):
433433

434434
lines = text.split("\n")
435435

436-
margin = os.path.commonprefix(tuple(filter(lambda x: x.lstrip(), lines)))
436+
margin = os.path.commonprefix([line for line in lines if line.lstrip()])
437437
margin_len = len(margin) - len(margin.lstrip())
438438

439439
return "\n".join([line[margin_len:] if line.lstrip() else "\n" if line.endswith("\n") else "" for line in lines])

0 commit comments

Comments
 (0)