Skip to content

Commit e78f278

Browse files
committed
Use any to abort as soon as condition is true
1 parent 5ebdba2 commit e78f278

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

curtsies/formatstringarray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ def fsarray(strings, *args, **kwargs):
6464
if "width" in kwargs:
6565
width = kwargs["width"]
6666
del kwargs["width"]
67-
if strings and max(len(s) for s in strings) > width:
68-
raise ValueError("Those strings won't fit for width %d" % width)
67+
if strings and any(len(s) > width for s in strings):
68+
raise ValueError(f"Those strings won't fit for width {width}")
6969
else:
7070
width = max(len(s) for s in strings) if strings else 0
7171
fstrings = [

0 commit comments

Comments
 (0)