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/smtplib.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Lib/smtplib.py') diff --git a/Lib/smtplib.py b/Lib/smtplib.py index 05d2f8ccd73..18c91746fd7 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -1099,10 +1099,7 @@ if __name__ == '__main__': toaddrs = prompt("To").split(',') print("Enter message, end with ^D:") msg = '' - while 1: - line = sys.stdin.readline() - if not line: - break + while line := sys.stdin.readline(): msg = msg + line print("Message length is %d" % len(msg)) -- cgit v1.2.3