Is nan in (nan,) correct?
sohcahtoa82 at gmail.com
sohcahtoa82 at gmail.com
Thu Mar 5 18:27:32 EST 2015
On Thursday, March 5, 2015 at 3:20:16 PM UTC-8, Ben Finney wrote:
> 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
Do you have an example of where `a is b` but `a != b` in Python? `None == None` is True.
More information about the Python-list
mailing list