Ben Bacarisse <ben.use...@bsb.me.uk>: > Marko Rauhamaa <ma...@pacujo.net> writes: >> What I notice in my numbers is that about one half of my while loops >> are "while True", and about a third of my loops are while loops. > > I fo[u]nd the proportion on while True: loops surprising. Is there > something about Python that encourages that kind of loop?
Here's a typical example of such a loop in Python (ver 2): while True: try: snippet = os.read(rdfd, 1000) except OSError as e: if e.errno == errno.EAGAIN: return raise if not snippet: break self.stdout_snippets.append(snippet) I find myself writing similar loops in C a lot, as well. Marko -- https://mail.python.org/mailman/listinfo/python-list