9 Oct
2012
9 Oct
'12
1:56 a.m.
On Oct 08, 2012, at 03:44 PM, Mike Graham wrote:
I regularly see learners using "is" to check for string equality and sometimes other equality. Due to optimizations, they often come away thinking it worked for them.
There are no cases where
if x is "foo":
or
if x is 4:
is actually the code someone intended to write.
Although this has no benefit to anyone but new learners, it also doesn't really do any harm.
Conversely, I often see this: if x == None and even if x == True Okay, so maybe these are less harmful than the original complaint, but still, yuck! -Barry