bpo-45975: Simplify some while-loops with walrus operator (GH-29347)

This commit is contained in:
Nick Drozd
2022-11-26 16:33:25 -06:00
committed by GitHub
parent 25bc115df9
commit 024ac542d7
28 changed files with 41 additions and 153 deletions

View File

@@ -686,9 +686,7 @@ class HTMLDoc(Doc):
r'RFC[- ]?(\d+)|'
r'PEP[- ]?(\d+)|'
r'(self\.)?(\w+))')
while True:
match = pattern.search(text, here)
if not match: break
while match := pattern.search(text, here):
start, end = match.span()
results.append(escape(text[here:start]))