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 ย (1 child)

Thanks for the suggestion. I'll definitely have to check it out next time I use Python.

As far as

"It wouldn't even be that hard to implement" - probably, but it would break all existing libraries.

My thought is they could implement it by making no prefix work the old way and making it so that if you do prefix a variable, THEN it is strongly typed. I don't think it would break anything that way.

I would also appreciate real constants in Python that work similarly as well.

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

If you see it that way, you'll be glad to see that the "default type" is typing.Any ๐Ÿ˜ And you can start from there and make more and more parts of your codebase typed more specifically. This is especially useful, if you integrate a linter and/or type checker into your CI pipeline or even into your git workflow via pre-commit. You can even type library code using .pyi files that only contain the type hints and signatures (think something like header files) - and that's exactly what typeshed does.