Comparison Style
llanitedave
llanitedave at veawb.coop
Thu Apr 25 01:49:25 EDT 2013
Given that
s = some static value
i = a value incremented during a loop
I'm used to comparing them as
if i == s:
# some code
But for some unknown reason I did a switch
if s == i:
# same code
It didn't seem to make any difference at first glance, so I just got to wondering --
Is there a standard for comparison order? Is there any kind of performance difference? Is there even a tradition for one or the other? Are there any gotchas?
Do I need to get a hobby?
More information about the Python-list
mailing list