What do you think about this code:

for n in range(2, 10):...     for x in range(2, n):...         if n %
x == 0:...             print n, 'equals', x, '*', n/x...
break...     else:...         # loop fell through without finding a
factor...         print n, 'is a prime number'


I don't like this 'for - else' trick. IMHO it's confusing and not readable.

BTW, This code is taken from the python tutorial:
http://docs.python.org/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops


Ahik
_______________________________________________
Python-il mailing list
[email protected]
http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il

לענות