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 gdr@garethrees.org
Recipients docs@python, gdr@garethrees.org
Date 2016-07-22.09:50:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469181051.15.0.925508125369.issue27588@psf.upfronthosting.co.za>
In-reply-to
Content
The type objects constructed by the metaclasses in the typing module are hashable and comparable for equality:

    >>> from typing import *
    >>> {Mapping[str, int], Mapping[int, str]}
    {typing.Mapping[int, str], typing.Mapping[str, int]}
    >>> Union[str, int, float] == Union[float, int, str]
    True
    >>> List[int] == List[float]
    False

but this is not clearly documented in the documentation for the typing module (there are a handful of examples using equality, but it's not explicit that these are runnable).

It would be nice if there were explicit documentation for these properties of type objects.
History
Date User Action Args
2016-07-22 09:50:51gdr@garethrees.orgsetrecipients: + gdr@garethrees.org, docs@python
2016-07-22 09:50:51gdr@garethrees.orgsetmessageid: <1469181051.15.0.925508125369.issue27588@psf.upfronthosting.co.za>
2016-07-22 09:50:51gdr@garethrees.orglinkissue27588 messages
2016-07-22 09:50:50gdr@garethrees.orgcreate