The rap against "while True:" loops

Bearophile bearophileHUGS at lycos.com
Fri Oct 16 16:02:31 EDT 2009


Paul Rubin:

>  http://scholar.google.com/scholar?cluster=17368311454828547380
>
> Keep in mind that the article is 35 years old though, and is purely
> imperative.  Lots of stuff done with cockamamie looping constructs is
> more cleanly done with Python generators, itertools, higher-order
> functions, etc.

That's a famous and very good paper, a good read for people that like
to program.
The Example1 and Example2 can be rewritten in several different ways,
but several compilers today are not able to perform such optimizations
yet, so what Knuth has written there are still among the faster ways
to implement that algorithm.

Bye,
bearophile



More information about the Python-list mailing list