Proposal: === and !=== operators

Roy Smith roy at panix.com
Wed Jul 9 16:47:22 EDT 2014


In article <53bd3a1d$0$29995$c3e8da3$5496439d at news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:

> On Wed, 09 Jul 2014 08:27:28 -0400, Roy Smith wrote:
> 
> > We would have *three* ways to compare for equality (==, ===, and is).
> 
> `is` does not, never has, and never will, be a test for equality.
> 
> py> x = []
> py> y = []
> py> x is y
> False

That is a very narrow legalistic way of looking at things.  If you don't 
like the word "equality", substitute a more generic word, such as 
"sameness"  We continually have threads about when to use "==" and when 
to use "is".  Clearly, there is confusion about them.  Adding another 
way to test for sameness will just increase the confusion.



More information about the Python-list mailing list