On Mon, Oct 8, 2012 at 10:14 PM, Guido van Rossum
Maybe we should do something more drastic and always create a new, unique constant whenever a literal occurs as an argument of 'is' or 'is not'? Then such code would never work, leading people to examine their code more closely. I betcha we have people who could change the bytecode compiler easily enough to do that. (I'm not seriously proposing this, except as a threat of what we could do if the SyntaxWarning is rejected. :-)
Is this any better than making `x is 0` raise a TypeError with a message about what's wrong (as suggested by Mike Graham)? In both cases, `x is 0` is basically worthless, but at least if it raises an exception people can understand what "went wrong", because of the error message that comes with the exception. -- Devin