mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
bpo-45975: Simplify some while-loops with walrus operator (GH-29347)
This commit is contained in:
parent
25bc115df9
commit
024ac542d7
28 changed files with 41 additions and 153 deletions
|
@ -194,10 +194,7 @@ def copyfileobj(fsrc, fdst, length=0):
|
|||
# Localize variable access to minimize overhead.
|
||||
fsrc_read = fsrc.read
|
||||
fdst_write = fdst.write
|
||||
while True:
|
||||
buf = fsrc_read(length)
|
||||
if not buf:
|
||||
break
|
||||
while buf := fsrc_read(length):
|
||||
fdst_write(buf)
|
||||
|
||||
def _samefile(src, dst):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue