[Python-Dev] Re: Migrate typing in builtin

2019-10-07 Thread Random832
On Mon, Oct 7, 2019, at 12:02, Philippe Prados wrote: > 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: > pa

[Python-Dev] Re: Migrate typing in builtin

2019-10-07 Thread Ivan Levkivskyi
On Mon, 7 Oct 2019 at 17:16, Guido van Rossum wrote: > Hi Philippe, > > Maybe the implementation of `_GenericAlias` should live in > Objects/typobject.c, and be a part of the public API. Then the "|" overload > on PyType_Type (also there) can reference it directly, it can be exported > from Pytho

[Python-Dev] Re: Migrate typing in builtin

2019-10-07 Thread Guido van Rossum
Hi Philippe, Maybe the implementation of `_GenericAlias` should live in Objects/typobject.c, and be a part of the public API. Then the "|" overload on PyType_Type (also there) can reference it directly, it can be exported from Python/bltinsmodule.c, and typing can reference it as a builtin. --Gui

[Python-Dev] Re: Migrate typing in builtin

2019-10-07 Thread Philippe Prados
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

[Python-Dev] Re: Migrate typing in builtin

2019-10-07 Thread Random832
On Mon, Oct 7, 2019, at 10:32, Philippe Prados wrote: > Hello, > > I try to implement a *proof of concept* of Pep-0604 > . > > To do this, the _GenericAlias must be in builtin, because I would like > to update issubclass() and isinstance() to accept Un

[Python-Dev] Migrate typing in builtin

2019-10-07 Thread Philippe Prados
Hello, I try to implement a *proof of concept* of 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 modu