HNHacker News
TopNewBestAskShowJobs

owlowlowls

6 karma · joined July 17, 2019

submissionscomments
owlowlowls··on What's Coming in Python 3.8
>I'll add that := fixes something I truly hate: the lack of `do until` in Python, which strikes me as deeply un-Pythonic. Am I supposed to break out of `while True`? Am I supposed to set the variable before and at the tail of the loop (a great way to add subtle typos that won't cause errors)?

This is relevant to what I've been doing in OpenCV with reading frames from videos! In tutorial examples on the web, you'll see exactly the sort of pattern that's outlined in the PEP 572 article.

>line = f.readline()

>while line:

> ... # process line

> line = f.readline()

Just, replace readline() with readframe() and the like. So many off-by-one errors figuring out when exactly to break.