Andreas Tawn wrote:
I think a better explanation is that in your original function, x only existed while the for loop was running. As soon as execution hit the break statement, x ceased to exist.
Wrong. For loop variables continue after the loop exits. This is intentional. Mensanator gave the correct explanation (loop never enters for nbr==1).
-- http://mail.python.org/mailman/listinfo/python-list