[Python-ideas] Optional static typing -- the crossroads

Chris Angelico rosuav at gmail.com
Sun Aug 17 16:37:46 CEST 2014


On Sun, Aug 17, 2014 at 8:31 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Disappointingly, Python's annotations make the same
> blunder as C, and most other languages since, in
> requiring each parameter to have its own individual
> annotation.

Python doesn't really have any option here, because a non-annotated
parameter already has meaning. But even in C-family languages, I'm not
sure that it's all that advantageous; it makes editing less clear, so
it's really only beneficial when you have sets of related arguments
(eg "int r,g,b" to specify a color). With variable declarations,
there's a difference between "int r,g,b; double x,y,z;", where the
block of integers is terminated by a semicolon (and, conventionally, a
line ending); in argument lists, you don't get that, so it's not as
clear where one starts and one stops. (Imagine you misspell a type
name. It's no longer a keyword. How will your mistake be reported?)

ChrisA


More information about the Python-ideas mailing list