
On Thu, Jun 17, 2021 at 1:52 AM Sebastian Rittau <srittau@rittau.biz> wrote:
Am 16.06.21 um 20:05 schrieb Guido van Rossum:
If we were to allow this, it'd be harder to give a simple rule for when the argument names can be omitted or not -- for example would we allow this?
f: (int, name: str) -> bool
or this?
f: (count: int, str) -> bool
or even this?
f: (a: int, b, c: str) -> bool
If we allow the shorthand, I believe we should allow either the shorthand or the full syntax, but not to mix both. My current stance is +1 for the full syntax, +0 for also allowing the shorthand, and -1 for special casing underscores. I'm not totally sold on the shorthand, due to the inconsistency and possible confusion with normal Python syntax and the two ways to do things. On the other hand writing `def foo(cb: (int) -> Any) -> None:` is more practical than writing `def foo(cb: (x: int, /) -> Any) -> None: ...`. But I'm not sure the conciseness is worth it.
Yes, it is worth it. Of all the typing constructs currently expressed using the form SomeOperator[arg, arg, ...], Callable is second after Union (which already has a new notation, a|b). So I think the new notation is important, and excess verbosity is undesirable. We can debate whether the shorthand and full notation can be mixed, and about underscores (which we won't need if we have the shorthand). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>