seeking deeper (language theory) reason behind Python design choice

Ian Kelly ian.g.kelly at gmail.com
Fri May 11 02:54:56 EDT 2018


On Thu, May 10, 2018 at 11:45 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> To be honest, I'm having trouble thinking of a good use-case for "while
> True", now that we have infinite iterators. Most cases of
>
>     while True:
>         x = get_item()
>         if not x: break
>         process(x)
>
> are better written as:
>
>     for x in iterator:
>         process(x)

x = get_item()
while True:
    x = process(x)



More information about the Python-list mailing list