找出首参数分派里的 bug

来自 单分派泛型函数
Python 3.14 入门 4分钟 找出 1处问题

只要 destination 是字符串,就应运行文本处理器。请找出这次调用没有命中的原因。

Python
from functools import singledispatch

@singledispatch
def ship(payload, destination):
    return f"default:{payload}:{destination}"

@ship.register(str)
def ship_text(payload, destination):
    return f"text:{payload}:{destination}"

print(ship(100, "Paris"))
在试验场中打开
报告错误