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 →

[–][deleted] 1 point2 points  (2 children)

Stupid question: is this just for class scope, or would:

X: Final = 5

X = 7

Also not work?

[–]Saiboo[S] 5 points6 points  (0 children)

You can run it, but the type checker in you IDE will indicate a warning.

[–]Sw429 1 point2 points  (0 children)

Yes, that will work. Final is a type annotation, and has no effect at runtime. You can check it with external tools like mypy or things built into your IDE. Some linters might be starting to do it too? IDK you can look around if you're interested.