On Mon, Feb 15, 2021 at 12:29 PM Ricky Teachey
f(x,y)=>x+y->str
I can't -1 this enough. How do I read this? Imagine you have never seen this discussion and you come across this code in the wild. You are familiar with type hints, including return type annotations, but aren't familiar with this syntax. From that perspective, what does this code mean? 1) Define a function that returns x plus an instance of typing.Callable[[y], str] (assuming that the discussed Callable shorthand has been adopted) 2) Define a function that returns the sum of x and y, but with the return type annotated as a str 3) Call the function f with arguments x and y, and attempt to compare the return value to... something (except the user made a typo and you'll actually get a syntax error) 4) Absolutely nothing and it's just random electronic scribbling by the author that won't compile and they forgot to comment out (yes, that's always an option) Frankly, it's not obvious to me. Some mental gymnastics might eventually land me at 2), but now my head hurts. My preferred spelling of the above (with the addition of sample parameter type hints) would be: f(x: int, y: int) -> str: x, y (No, the type hints don't make sense. They're just an example of syntax.) Benefits over your proposal: 1) No ugly => that looks like a greater-or-equal operator if you haven't had your morning coffee 2) Looks a lot more like existing syntax (the smaller the delta between old and new, the easier it is to learn and adopt the new). In fact, it basically IS existing syntax, except for the lack of a "def" in front and an explicit "return" keyword (seriously, insert those two keywords and it compiles already). 3) Works just as well with anonymous functions: `(x: int, y: int) -> str: x, y` is clear and and easy to deduce the meaning of to anyone familiar with basic Python syntax 4) Much more Pythonic than the => syntax -- because it already looks like Python code. Even with that spelling, I'm -0.5 on the named function version (for the reasons described by Guido), and only +0.5 on the anonymous version (because I'm not convinced that it's needed).