diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-02-03 02:28:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 02:28:52 (GMT) |
commit | 2ddc278875f789de622262ee8ff5a1c3788f031c (patch) | |
tree | a980bdaaddc7caa6d6006f0590ab7b67ad65decd /Lib/idlelib/replace.py | |
parent | 5765eaa13654e5f812a286700da7d6b8e144da0e (diff) | |
download | cpython-2ddc278875f789de622262ee8ff5a1c3788f031c.zip cpython-2ddc278875f789de622262ee8ff5a1c3788f031c.tar.gz cpython-2ddc278875f789de622262ee8ff5a1c3788f031c.tar.bz2 |
bpo-45975: Use walrus operator for some idlelib while loops (GH-31083)
(cherry picked from commit 51a95be1d035a717ab29e98056b8831a98e61125)
Co-authored-by: Nick Drozd <nicholasdrozd@gmail.com>
Diffstat (limited to 'Lib/idlelib/replace.py')
-rw-r--r-- | Lib/idlelib/replace.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/idlelib/replace.py b/Lib/idlelib/replace.py index 2f9ca23..ac04ed9 100644 --- a/Lib/idlelib/replace.py +++ b/Lib/idlelib/replace.py @@ -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() |