I’m a bit confused. For my own understanding: what’s stopping
PyObject_IsInstance/PyObject_IsSubclass from just trying
PyImport_GetModule("typing") here?
If NULL, carry on. Otherwise, check the Union case.
Brandt
> On Oct 8, 2019, at 05:44, Philippe Prados <[email protected]> wrote:
>
>
> Glups.
>
> I am not an expert of Pyhton source code. May be after this patch ;-)
>
> I think I should discuss with the authors of the module typing, to identify
> the best strategy.
> Who is he ?
>
> Philippe
>
>
>> Le mar. 8 oct. 2019 à 10:19, Ivan Levkivskyi <[email protected]> a écrit :
>> You will need to rewrite most of things in C.
>>
>> --
>> Ivan
>>
>>
>>> On Tue 8 Oct 2019, 08:53 Philippe Prados, <[email protected]> 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's possible to merge the C
>>> and Python in builtin and add a direct reference to _GenericAlias with C,
>>> and add the reference in builtin module ?
>>>
>>> Philippe
>>>
>>>
>>>> Le lun. 7 oct. 2019 à 22:58, Random832 <[email protected]> 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 operator __or__() for type type.
>>>> > def f(list: List[int | str], param: int | None) -> float | str:
>>>> > pass
>>>>
>>>> Oh, sorry, I didn't realize that this also included the | operator, I
>>>> thought this was just for isinstance("", Union[int, str]).
>>> _______________________________________________
>>> Python-Dev mailing list -- [email protected]
>>> To unsubscribe send an email to [email protected]
>>> https://mail.python.org/mailman3/lists/python-dev.python.org/
>>> Message archived at
>>> https://mail.python.org/archives/list/[email protected]/message/GD7WXPD26VUPMZT6WAATCJJBB42DDYYQ/
>>> Code of Conduct: http://python.org/psf/codeofconduct/
> _______________________________________________
> Python-Dev mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/4K7WZ3RBGG7K6E6XK65MS44VQYZIKQS2/
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/RYGHVWJZT76GNDWNRSOLA74SHZFNDW42/
Code of Conduct: http://python.org/psf/codeofconduct/