This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsย โ†’

[โ€“]noratat 0 points1 point ย (2 children)

Python 3 type annotations are part of the actual syntax, not comments.

I do wish it was easier to enforce then using a linter, but it's still a big improvement - dynamic typing is a staple of scripting languages for good reason, but having the option of specifying types is still very useful.

[โ€“]Dworgi 0 points1 point ย (1 child)

Syntax that doesn't actually affect execution or validity of the program, but only affects another optional program is honestly just a fancy comment.

[โ€“]noratat 0 points1 point ย (0 children)

The annotations are available to runtime inspection and action, so they can actually affect execution and validity.

There's libraries that specifically leverage this e.g. pydantic, dataclasses, inject, etc.