[Python-Dev] Re: Implementation of PEP-0604

2019-11-12 Thread Philippe Prados
Cool ! I'm very happy you take time to do this job. Your idea to use a shadowobject objet to promote just-in-time is very good for me, and can be used for others extensions. Thanks Philippe Prados Le sam. 9 nov. 2019 à 00:12, Richard Eames a écrit : > Hi Philippe and list, >

[Python-Dev] Implementation of PEP-0604

2019-10-31 Thread Philippe Prados
To implement a full version of PEP604 , I analyze the typing module, started with _GenericAlias. 1) I must rewrite : - def _type_check(arg, msg, is_argument=True) - def _type_repr(obj) - def _collect_type_vars(types) - def _subs_tvars(tp, tvar

[Python-Dev] Re: Migrate typing in builtin

2019-10-09 Thread Philippe Prados
it might end up on recursion. > > On Tue, Oct 8, 2019 at 09:06 Brandt Bucher wrote: > >> I’m a bit confused. For my own understanding: what’s stopping >> PyObject_IsInstance/PyObject_IsSubclass from just trying >> PyImport_GetModule("typing") here? >> >&

[Python-Dev] Re: Migrate typing in builtin

2019-10-08 Thread Philippe Prados
ngs in C. > > -- > Ivan > > > On Tue 8 Oct 2019, 08:53 Philippe Prados, > wrote: > >> Ok, >> >> But _GenericAlias and dependencies are written with Python >> (Lib/typing.py), not with C. >> So, I must rewrite the _GenericAlias in C or it

[Python-Dev] Re: Migrate typing in builtin

2019-10-08 Thread Philippe Prados
Le lun. 7 oct. 2019 à 22:58, Random832 a écrit : > 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 opera

[Python-Dev] Re: Migrate typing in builtin

2019-10-07 Thread Philippe Prados
29, Random832 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 bu

[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