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 a slide deck I presented in 2000 on the topic still exists: https://gvanrossum.github.io/static-typing/ This shows something pretty close to the modern notation for function and variable annotations, but with a `decl` keyword thrown in. On Fri, Mar 5, 2021 at 3:08 AM Steven D'Aprano <st...@pearwood.info> wrote: > I was curious how and why return annotations use the arrow `->` symbol, > so I went spelunking into the depths of the Python-Ideas and Python-Dev > mailing lists. > > Much to my surprise, I couldn't find any discussion or debate about it. > > Eventually I tracked the discussion back to a mailing list I didn't even > know existed, Types-Sig, all the way back to 13th Dec 1999, where I > found this email by Tim Hochberg: > > https://mail.python.org/pipermail/types-sig/1999-December/000281.html > > suggesting the arrow symbol for all type declarations. This appears to > be the first suggestion of the arrow symbol for type annotations in > Python. > > I am surprised that type checking was being discussed so long ago. > Python was not even a decade old, and if my calculations are correct, > the versions at the time would have been 1.5.2 and 1.6.0. > > But I am especially amazed that the choice of symbol seems to have been > accepted with very little argument or debate about alternative colours > for the bike-shed. I can't find any suggestions for alternative symbols > such as `=>` `-->` `==>` `->>` etc, and very little for keywords such as > `as`. The day after Tim posted, Tony Lownds suggested `as` and then > immediately suggested using Tim's arrow symbol for the return type only: > > https://mail.python.org/pipermail/types-sig/1999-December/000335.html > > and then as far as I can tell, we've never looked back. > > If there is anyone whose memory reaches back that far, does that sound > right? > > > -- > Steve > _______________________________________________ > 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/4ZZP5DJARHHKN4HBC4JHHRIV5Z2EZOVT/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --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-change-the-world/>
_______________________________________________ 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/RUNYLIQ3NAV7RRRKR4XCAAWA2S37ESQ2/ Code of Conduct: http://python.org/psf/codeofconduct/