Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1d455f

Browse files
JulienPalardmatrixise
authored andcommitted
Doc: Use walrus operator in example. (GH-15934)
1 parent 37c2220 commit e1d455f

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

Doc/library/http.client.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,7 @@ Here is an example session that uses the ``GET`` method::
516516
>>> # The following example demonstrates reading data in chunks.
517517
>>> conn.request("GET", "/")
518518
>>> r1 = conn.getresponse()
519-
>>> while True:
520-
... chunk = r1.read(200) # 200 bytes
521-
... if not chunk:
522-
... break
519+
>>> while chunk := r1.read(200):
523520
... print(repr(chunk))
524521
b'<!doctype html>\n<!--[if"...
525522
...

0 commit comments

Comments
 (0)