05.07.18 01:51, Victor Stinner пише:
== Pattern 1, straighforward ==

while True:
     line = input.readline()
     if not line:
         break
     ...

IMHO here assingment expression is appropriate here. The code remains
straighfoward to read.

while (line := input.readline()):
     ...

We already have an idiom for this:

for line in input:
    ...

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to