DEV Community

Discussion on: Using Python's Type Annotations

Collapse
 
davedavemckay profile image
David McKay

Interesting addition. As an intermediate level coder seeing this for the first time I can see it being useful of every developer looking at the code well read on the syntax. edA-qa makes a good point that it could lead to some people thinking they're making a runtime change when really they're not. The following syntax would make more sense to me:
number = 7 : int
Then the definition is separated from the annotation similarly to an end-of-line comment, which I often use, i.e.,
number = 7 # an integer

Collapse
 
thomasvl profile image
Thomas van Latum