[Python-ideas] Make "is" checks on non-singleton literals errors
Calvin Spealman
ironfroggy at gmail.com
Tue Oct 9 03:14:57 CEST 2012
On Mon, Oct 8, 2012 at 3:44 PM, Mike Graham <mikegraham at gmail.com> 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.
+1
> Mike
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
--
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy
More information about the Python-ideas
mailing list