This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Janusz Harkot, docs@python, mark.dickinson, terry.reedy, tim.peters
Date 2018-05-18.19:44:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526672650.81.0.682650639539.issue33572@psf.upfronthosting.co.za>
In-reply-to
Content
With Tim's addition

>>> from fractions import Fraction as F
>>> from decimal import Decimal as D
>>> s = {0, 1, 0.0, 1.0, F(0,1), F(1, 1), D(0), D(1), False, True}
>>> s
{0, 1}

I think we should consider moving the main discussion of the general comparison and hashing principle and example to the set entry.  (Sets ars simpler and are when people new to Python already know about.) Point out that for displays, the first of equals is kept and not replaced (this is also true of dicts).  Then, in the dict entry, say that dict keys are treated like set items, give an equivalent dict example, and link to the discussion of set items.

>>> x = None
>>> d = {0:x, 1:x, 0.0:x, 1.0:x, F(0,1):x, F(1, 1):x, D(0):x, D(1):x, False:x, True:x}
>>> d
{0: None, 1: None}
>>>
History
Date User Action Args
2018-05-18 19:44:10terry.reedysetrecipients: + terry.reedy, tim.peters, mark.dickinson, docs@python, Janusz Harkot
2018-05-18 19:44:10terry.reedysetmessageid: <1526672650.81.0.682650639539.issue33572@psf.upfronthosting.co.za>
2018-05-18 19:44:10terry.reedylinkissue33572 messages
2018-05-18 19:44:10terry.reedycreate