Skip to content

[spec] Overload processing order #1803

Open
@srittau

Description

@srittau

It's my understanding that overloads are processed in order. I.e. given the following overloads:

@overload
def foo(x: int) -> None: ...
@overload
def foo(x: int | str) -> None: ...
@overload
def foo(x: str) -> None: ...

When called with an int, the first overload is matched, when called with a str, the second is matched. The third is never matched. (Not going into what happens when called with int | str.) Currently, this behavior is not mentioned in the spec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions