[Python-il] [pyweb-il:1049] Python coding question

Ron Reiter ron.reiter at gmail.com
Thu Jul 1 14:51:28 IDT 2010


They should have used another keyword.
I guess it's too late now :)

On Thu, Jul 1, 2010 at 2:48 PM, Ahik Man <ahik.man at gmail.com> wrote:

> 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
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "PyWeb-IL" group.
> To post to this group, send email to pyweb-il at googlegroups.com.
> To unsubscribe from this group, send email to
> pyweb-il+unsubscribe at googlegroups.com<pyweb-il%2Bunsubscribe at googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/pyweb-il?hl=en.
>



-- 
-- Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://hamakor.org.il/pipermail/python-il/attachments/20100701/936cbc6f/attachment.htm 


More information about the Python-il mailing list