On Wed, Apr 6, 2016 at 8:14 AM, Marko Rauhamaa <ma...@pacujo.net> wrote: > Now, if Python had an unlimited range() iterator/iterable, you could use > a "for" statement to emulate "while".
You can already do this. >>> class While: ... def __init__(self, predicate): ... self._predicate = predicate ... self._exited = False ... def __iter__(self): ... return self ... def __next__(self): ... if self._exited or not self._predicate(): ... self._exited = True ... raise StopIteration ... >>> i = 0 >>> for _ in While(lambda: i < 10): ... print(i) ... i += 1 ... 0 1 2 3 4 5 6 7 8 9 > As it stands, Python without "while" could only compute > primitive-recursive functions. However, you only need "while" a maximum > of one time in your whole program to perform an arbitrary computation. So this is wrong. -- https://mail.python.org/mailman/listinfo/python-list