Le 14/04/2021 à 19:44, Guido van Rossum a écrit :
No, what I heard is that, since in *most* cases the string quotes are not needed, people are surprised and annoyed when they encounter cases where they are needed. And if you have a large code base it takes an expensive run of the static type checker to find out that you've forgotten the quotes.
Well, I had assumed quotes would be used in all cases for consistency. Indeed, using them only if needed leads to surprises. Are there specific annoyances associated with quoting always, apart from the 2 more characters?
They will treat it as anything else they don't quite understand -- they will ignore it unless it bites them. And the rule for finding the end of an annotation would be very simple -- just skip words until the next comma, close paren or colon, skipping matching brackets etc.
That's assuming the syntax in the annotations doesn't diverge too much from the Python syntax as far as brackets etc are concerned. I must say I'm not too worried about typing. But the hypothetic "def foo(prec: --precision int):" is already less readable. Will finding the closing comma or colon always be obvious to the human reader?