Planning a Python Course for Beginners
Marko Rauhamaa
marko at pacujo.net
Thu Aug 10 09:59:41 EDT 2017
Python <python at example.invalid>:
> Marko Rauhamaa wrote:
>> id() is actually an ideal return value of __hash__(). The only criterion
>> is that the returned number should be different if the __eq__() is
>> False. That is definitely true for id().
>
> $ python
> Python 2.7.13 (default, Jan 19 2017, 14:48:08)
> [GCC 6.3.0 20170118] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> nan = float('NaN')
>>>> id(nan) == id(nan)
> True
>>>> nan == nan
> False
>>>>
Point being?
Marko
More information about the Python-list
mailing list