Because this PEP propose to accept, for all classes assert isinstance("", int | str) assert issubclass(int, int | str)
and add an operator __or__() for type type. def f(list: List[int | str], param: int | None) -> float | str: pass Regards Philippe Le lun. 7 oct. 2019 à 17:29, Random832 <random...@fastmail.com> a écrit : > On Mon, Oct 7, 2019, at 10:32, Philippe Prados wrote: > > Hello, > > > > I try to implement a *proof of concept* of Pep-0604 > > <https://www.python.org/dev/peps/pep-0604/>. > > > > To do this, the _GenericAlias must be in builtin, because I would like > > to update issubclass() and isinstance() to accept Union. > > These methods are in builtin, and must be run without others modules. > > Why can't this be handled as an __instancecheck__/__subclasscheck__? > _______________________________________________ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/UZRHLKTGR7USOD365N57Y2QVUWWMGPJ7/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/LASLJP2MRQWSWUHD4PCJJ2D3SOWL6SAD/ Code of Conduct: http://python.org/psf/codeofconduct/