It's not possible now, before the PEP 335 was accepted, to overload the "or" operator.

Le ven. 20 sept. 2019 à 14:41, Sebastian Rittau <srittau@rittau.biz> a écrit :
Am 20.09.19 um 11:19 schrieb Philippe Prados:
I just publish the PEP-0604 for discussions (https://www.python.org/dev/peps/pep-0604/).

I'm strongly in favor of a more succinct syntax for both Union and Optional. But just to add my own bike-shedding to it: I prefer using the "or" operator over the "|" operator for Union. This feels more in line with existing Python operators and the preference for speaking code. "or" is the logical OR, while "|" is used for bit-wise operations. "x: int or str" is also quite intuitive. I also echo the sentiments of using "~" for Optional. As the bit-wise inversion operator it has quite a different meaning at the moment.

 - Sebastian

_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/