New submission from Gareth Rees: 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. ---------- assignee: docs@python components: Documentation messages: 270981 nosy: Gareth.Rees, docs@python priority: normal severity: normal status: open title: Type objects are hashable and comparable for equality but this is not documented type: enhancement versions: Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27588> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com