[issue46014] functools.singledispatch does not support Union types

Alex Waygood report at bugs.python.org
Thu Dec 30 08:42:12 EST 2021


Alex Waygood <Alex.Waygood at Gmail.com> added the comment:

```
>>> from typing import Optional, get_origin
>>> get_origin(Optional[int])
typing.Union
```

^Because of that, it will work with typing.Optional as well as typing.Union and types.UnionType, yes.

I am planning on submitting a docs PR at some point in the next few days (probably linked to a new BPO issue).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46014>
_______________________________________


More information about the Python-bugs-list mailing list