Re: confused about == vs === in this equality
- To: mathgroup at smc.vnet.net
- Subject: [mg103760] Re: confused about == vs === in this equality
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Mon, 5 Oct 2009 07:38:15 -0400 (EDT)
- References: <20091003104738.LCJ3I.416659.imail@eastrmwml34> <ha9qqp$7vi$1@smc.vnet.net>
Nasser Abbasi wrote: > > I guess I am a little confused about the "expression" bit in the definition. > > So, when using the 3"=", it is looking at the _value_ of the expression, but > when using the 2"=", it is looking at the expression _as it is_, i.e. > without evaluating it? Is this the difference? I've always used the 2"=" > for equality, now I have to be more careful which to use. > > --Nasser > > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4478 (20091003) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > > No - both comparisons evaluate both sides before comparing. The real issue is that i==3 will return unevaluated if i does not have a value, whereas i===3 will return False unless i has the value 3 . === compares things as they are (after evaluation), it never returns unevaluated. The comparison operator == is a little picky as to what it compares. I am not certain, but possibly it does not 'like' comparing one infinity with another for mathematical reasons. David Bailey http://www.dbaileyconsultancy.co.uk