Skip to content

Support Unions #3

Description

@neighthan

Just try each type in the Union until one of them works; re-raise the last exception if none do. Make a factory for this which takes in a Union annotation and returns a function that will try all of the types so that we can just assign that function as the type directly. Remember to change the function's __name__, though, so the error messages look better (have the name be the type annotation string, e.g. Union[int, bool]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions