
On Fri, Oct 8, 2021 at 1:45 PM S Pradeep Kumar <gohanpra@gmail.com> wrote:
The Callable type is also usable as an expression, like in type aliases `IntOperator = (int, int) -> int` and `cast((int) -> int, f)` calls.
**Question 1**: Are there concerns we should keep in mind about such a syntax proposal?
Either I'm reading this wrongly, or this is oddly inconsistent with tuples. With a tuple, it's the comma that defines it; with function parameters here, it looks like the parentheses are mandatory, and they are what define it? Which of these will be valid? x = int -> int y = int, int -> int # tuple containing (int, Callable) or function taking two args? z = (int,) -> int Given the examples you've shown, my intuition is that it should match def statement syntax - namely, the args are always surrounded by parentheses, a trailing comma is legal but meaningless, and it has nothing to do with tuple display. It would be very convenient for one-arg functions to be able to be defined the way x is, and I suspect people will try it, but it introduces annoying ambiguities. There are parallel proposals to support a lambda syntax like "x => x.spam" as equivalent to "lambda x: x.spam", so I'm curious what the rules would be for the two types of arrows, and whether they'd be consistent with each other. ChrisA