Nanderson <mandersonrandersonander...@gmail.com> writes:

> loop would be infinite. I get what is happening in the function, and I
> understand why this would work, but for some reason it's confusing me
> as to how it is exiting the loop after a certain number of times. Help
> is appreciated, thanks.

It works because 0 tests false and because integer division yields
integers... eventually you'll get something like 1/10 giving 0.

It's not necessarily a good thing to rely on. For example if you try it
after "from __future__ import division" - or in python 3 - you'll get a
float as the result of the division and it won't test False.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to