Is nan in (nan,) correct?

Ben Finney ben+python at benfinney.id.au
Thu Mar 5 18:20:10 EST 2015


sohcahtoa82 at gmail.com writes:

> I would argue that if `a is b` then it is obvious that `a == b`

It may be obvious, but it's not necessarily true. Some commonly-used
values – for example, an “null” – are not equal to themselves, by
definition.

It is fine to define such a type in Python, because ‘is’ does not
necessarily imply ‘==’.

> I would also argue that the "in" operator *SHOULD* be using equality
> of value.

Hopefully you can see how that argument is incorrect.

-- 
 \       “Yesterday I told a chicken to cross the road. It said, ‘What |
  `\                                             for?’” —Steven Wright |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list