Try... except....Try again?

Andre Engels andreengels at gmail.com
Fri Jul 17 07:33:03 EDT 2009


On Fri, Jul 17, 2009 at 7:31 AM, Xavier Ho<contact at xavierho.com> wrote:
> I have a simple class that generates prime numbers, using memorisation and
> iteration to generate the next prime number.
>
> In the class, I have defined a function that gives, say, the 5th prime
> number. Or the 1000th, it's still very fast. But the code isn't what I
> really like.
[...]
> My problem is that it's a "While True" loop, which I get a lot of "Don't do
> it!" In the light of making the code better, what could I do?

Where do you get these "Don't do it!"s? As far as I know, "while true"
loops are a very acceptable idiom for programming in Python (and
several other languages).


-- 
André Engels, andreengels at gmail.com



More information about the Python-list mailing list