diff options
Diffstat (limited to 'Lib/typing.py')
-rw-r--r-- | Lib/typing.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index e2fb7d1..0570b4e 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -375,6 +375,12 @@ class _SpecialForm(_Final, _root=True): def __call__(self, *args, **kwds): raise TypeError(f"Cannot instantiate {self!r}") + def __or__(self, other): + return Union[self, other] + + def __ror__(self, other): + return Union[other, self] + def __instancecheck__(self, obj): raise TypeError(f"{self} cannot be used with isinstance()") |