Haskell and the MLs are older than I am and use "->" to mark their function types (their functions are curried, but it clearly counts). Given the overall influence functional languages have had on modern typing, their influence making itself felt here would be unsurprising.
On Sat, 6 Mar 2021 at 07:47, Antoine Pitrou <anto...@python.org> wrote: > On Fri, 5 Mar 2021 16:45:25 -0800 > Guido van Rossum <gu...@python.org> wrote: > > > Good question. I don't think anyone has ever asked this before... Given > the > > variants you propose, I'd say that the 3-character ones would be more > > effort to type without real benefits, and `=>` would at the time (and > > perhaps still :-) be seen as too close to `>=`. > > > > Could it be that there were already other languages using `->` for return > > types? I do know that we needed something there -- from the start I was a > > fan of `x: int` because it's the same as Pascal (the language I used most > > intensely in college), and if it had been syntactically possible I would > > have used 'def f(): int' for the return type as well, but the LL(1) > parser > > in use in 1999-2000 would interpret that as a very short function body. > > > > It's also possible that it comes from the `->` operator in C, which would > > be the only "ASCII art arrow" that I was familiar with at the time. > > Note that nowadays you can use `->` to denote function return types in > C++ (that was not the case in 1999, though). > It's also the only allowed style for anonymous functions ("lambdas"): > https://en.cppreference.com/w/cpp/language/function > https://en.cppreference.com/w/cpp/language/lambda > > Regards > > Antoine. > > > _______________________________________________ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/K75WNUFDLY55FMYY5UID7EEEXWGNJZY3/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/ULU6EOEKPR7RQQ7VEHICIG6WBKBJ3KOI/ Code of Conduct: http://python.org/psf/codeofconduct/