On 05.07.2018 9:23, Serhiy Storchaka wrote: > 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: > ... > This is not strictly equivalent: it has internal caching unaffected by -u and you can't iterate and .read() at the same time. Though in this specific case (the example is from Lib\base64.py AFAICS), the change to `for' is fine. > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru -- Regards, Ivan
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4