Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Perl vs. Python for prime numbers

by eyepopslikeamosquito (Chancellor)
on Jun 14, 2013 at 10:09 UTC ( #1038936=note: print w/replies, xml ) Need Help??

in reply to Re: Perl vs. Python for prime numbers
in thread Perl vs. Python for prime numbers

The algorithm is lifted straight from the standard Python documentation, presumably as a toy example to illustrate the quirky "else" clause of Python loop statements.

  • Comment on Re^2: Perl vs. Python for prime numbers

Replies are listed 'Best First'.
Re^3: Perl vs. Python for prime numbers
by BrowserUk (Pope) on Jun 14, 2013 at 10:23 UTC

    Ug. Those docs sum up my feelings exactly:

    (Yes, this is the correct code. Look closely: the else clause belongs to the for loop, not the if statement.)

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1038936]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2018-01-21 10:55 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (227 votes). Check out past polls.