bpo-45975: Use walrus operator for some idlelib while loops (GH-31083)

This commit is contained in:
Nick Drozd 2022-02-02 19:59:24 -06:00 committed by GitHub
parent 164a017e13
commit 51a95be1d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 24 deletions

View file

@ -158,11 +158,8 @@ class ReplaceDialog(SearchDialogBase):
first = last = None
# XXX ought to replace circular instead of top-to-bottom when wrapping
text.undo_block_start()
while True:
res = self.engine.search_forward(text, prog, line, col,
wrap=False, ok=ok)
if not res:
break
while (res := self.engine.search_forward(
text, prog, line, col, wrap=False, ok=ok)):
line, m = res
chars = text.get("%d.0" % line, "%d.0" % (line+1))
orig = m.group()