Make "is" checks on non-singleton literals errors
8 Oct
2012
8 Oct
'12
7:44 p.m.
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. Mike
4188
Age (days ago)
4190
Last active (days ago)
28 comments
14 participants
participants (14)
-
Antoine Pitrou
-
Arnaud Delobelle
-
Barry Warsaw
-
Calvin Spealman
-
Chris Angelico
-
Devin Jeanpierre
-
Georg Brandl
-
Guido van Rossum
-
Joshua Landau
-
Masklinn
-
Mike Graham
-
Raymond Hettinger
-
Serhiy Storchaka
-
Steven D'Aprano