On Tue, Apr 18, 2017 at 4:06 PM, Christian Gollwitzer <aurio...@gmx.de> wrote: > Am 18.04.17 um 02:18 schrieb Ben Bacarisse: > >> Thanks (and to Grant). IO seems to be the canonical example. Where >> some languages would force one to write >> >> c = sys.stdin.read(1) >> while c == ' ': >> c = sys.stdin.read(1) >> >> Python opts for >> >> while True: >> c = sys.stdin.read(1) >> if c != ' ': break > > > This loop would be the archetypical do..while or repeat...until to me. > > do > c = sys.stdin.read(1) > while c== ' ' > > > -or- > > repeat > c = sys.stdin.read(1) > until c != ' '
Except that there's processing code after it. while True: c = sys.stdin.read(1) if not c: break if c.isprintable(): text += c elif c == "\x08": text = text[:-1] # etc Can you write _that_ as a do-while? ChrisA -- https://mail.python.org/mailman/listinfo/python-list