Is nan in (nan,) correct?
Ben Finney
ben+python at benfinney.id.au
Thu Mar 5 18:39:59 EST 2015
sohcahtoa82 at gmail.com writes:
> On Thursday, March 5, 2015 at 3:20:16 PM UTC-8, Ben Finney wrote:
> > It is fine to define such a type in Python, because 'is' does not
> > necessarily imply '=='.
>
> Do you have an example of where `a is b` but `a != b` in Python?
Maybe I misunderstand your question, but you've already been discussing
such an example. Here it is for clarity::
>>> nan = float("NaN")
>>> (nan is nan) == (nan == nan)
False
>>> nan is nan
True
>>> nan == nan
False
> `None == None` is True.
Right, the Python `None` is not the null I was describing. Python does
allow for a null with the semantics I described, because ‘is’ does not
imply ‘==’.
--
\ “We suffer primarily not from our vices or our weaknesses, but |
`\ from our illusions.” —Daniel J. Boorstin, historian, 1914–2004 |
_o__) |
Ben Finney
More information about the Python-list
mailing list