On 11/23/2010 8:22 AM Alan Gauld said...

"Richard D. Moores" <[email protected]> wrote

it was the way to go over "if n % 2 == 0". By my tests, it's 4.3% to
9.5% faster, depending on the integer tested - size and whether odd or
even. See the speed testing script and results at
<http://tutoree7.pastebin.com/iragLgDz>.

Did you try:

if n % 2: pass
else: do it here?


or

def x2(n):
    return not (n % 2)

Emile

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to