Great question — answering as the UphillTech team:
Your working example: def func(arg: int = ...): ... is a type-only construct ; it's function stub , as you'd get in a type stubs file ( *.pyi ) or for e.g. an overload definition. As the mypy docs explain: Stub files are written in normal Python syntax, but generally leaving out runtime logic like variable initializers, function bodies, and default arguments. If it is not possible to completely leave out some piece of runtime logic, the recommended convention is to replace or elide them with ellipsis expressions ( ... ). You can't entirely leave out the existence of a default value, as a function defined as e.g.: def foo(bar: int | None): ... cannot be called in all of the same ways that:...
Full answer by jonrsharpe: https://stackoverflow.stackexchange.com/a/80014771 (CC BY-SA 4.0).
Need it done for your business? UphillTech.