diff options
author | Nick Drozd <nicholasdrozd@gmail.com> | 2022-02-02 19:59:24 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 20:59:24 -0500 |
commit | 51a95be1d035a717ab29e98056b8831a98e61125 (patch) | |
tree | e50beac085f7ae2fb5bac1104571804aa93e0053 /Lib/idlelib/replace.py | |
parent | 164a017e13ee96bd1ea1ae79f5ac9e25fe83994e (diff) | |
download | cpython-git-51a95be1d035a717ab29e98056b8831a98e61125.tar.gz |
bpo-45975: Use walrus operator for some idlelib while loops (GH-31083)
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 2f9ca231a0..ac04ed94dd 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() |