Skip to content

Create a plugin to handle singledispatch #2904

Closed
@gbritton1

Description

@gbritton1

For me, this code:

from functools import singledispatch
@singledispatch
def cmp(other, match):
    return match in (..., other)

@cmp.register(type)
def _(other, match):
    return isinstance(match, other)`

results in the mypy error:

severity: 'Error'
message: 'error:'overload' decorator expected'

on the line @cmp.register(type)

mypy version:

PS C:\Program Files (x86)\Python36-32> .\scripts\mypy.bat --version
mypy 0.471
PS C:\Program Files (x86)\Python36-32>

What should I do to resolve the error?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions