mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +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
|
@ -224,9 +224,7 @@ class Unpacker:
|
|||
|
||||
def unpack_list(self, unpack_item):
|
||||
list = []
|
||||
while 1:
|
||||
x = self.unpack_uint()
|
||||
if x == 0: break
|
||||
while (x := self.unpack_uint()) != 0:
|
||||
if x != 1:
|
||||
raise ConversionError('0 or 1 expected, got %r' % (x,))
|
||||
item = unpack_item()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue