
Am 11.06.21 um 01:03 schrieb Eric Traut:
Examples: ```python C1 = (x: float, /) -> float # Equivalent to Callable[[float], float] C2 = (x: float) -> float # Not expressible with Callable C3 = (*, x: float) -> float # Not expressible with Callable C4 = (v: int, /, x: float) -> float # Not expressible with Callable C5 = (x: int, *args: str, **kwargs: str) -> int # Not expressible with Callable C6 = (*args: Any, **kwargs: Any) -> None # Equivalent to Callable[..., None] ```
I really like that these look exactly like function declaration minus "def" and the name. The question is whether to even allow something like "(float) -> float" as a "shortcut" for C1 above as suggested originally by Steven. The advantage is that it's a bit more concise for the common callback case, where names don't matter, the disadvantage is that it's inconsistent with existing Python syntax. If we go for the shortcut syntax we should always require parentheses around the arguments for readability and disambiguation. - Sebastian