New submission from Randolf Scholz <[email protected]>:
from functools import singledispatch
from typing import Optional
@singledispatch
def load(key: Optional[str] = None, /) -> None:
raise NotImplementedError
@load.register
def _(key: None, /) -> None:
print(f"loaded {key=}")
@load.register
def _(key: str, /) -> None:
print(f"loaded {key=}")
load() # TypeError: load requires at least 1 positional argument
----------
messages: 415274
nosy: randolf.scholz
priority: normal
severity: normal
status: open
title: singledispatch does not work with positional arguments with default
values.
type: enhancement
versions: Python 3.10, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue47030>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com