Skip to content

Commit 3a13b66

Browse files
committed
Add a comment to explain why sys.stdout.write() is used
1 parent f523453 commit 3a13b66

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Lib/test/memory_watchdog.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def watchdog(pid):
1919
# fail the same way.
2020
return
2121

22+
# Prefer sys.stdout.write() to print() to use a single write() syscall.
23+
# print(msg) calls write(msg.encode()) and then write(b"\n").
2224
sys.stdout.write(f" ... process data size: {mem / ONE_GIB:.1f} GiB\n")
2325
sys.stdout.flush()
2426
time.sleep(1)

0 commit comments

Comments
 (0)