From 024ac542d738f56b36bdeb3517a10e93da5acab9 Mon Sep 17 00:00:00 2001 From: Nick Drozd Date: Sat, 26 Nov 2022 16:33:25 -0600 Subject: bpo-45975: Simplify some while-loops with walrus operator (GH-29347) --- Lib/mailcap.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Lib/mailcap.py') diff --git a/Lib/mailcap.py b/Lib/mailcap.py index 7278ea7051..2f4656e854 100644 --- a/Lib/mailcap.py +++ b/Lib/mailcap.py @@ -90,9 +90,7 @@ def _readmailcapfile(fp, lineno): the viewing command is stored with the key "view". """ caps = {} - while 1: - line = fp.readline() - if not line: break + while line := fp.readline(): # Ignore comments and blank lines if line[0] == '#' or line.strip() == '': continue -- cgit v1.2.1