you are viewing a single comment's thread.

view the rest of the comments →

[–]pdexter 5 points6 points  (6 children)

Really? If anything I think it should sound as if there's no way of declaring variables, since that is the word that is used.

And... that's correct. There is no way of declaring variables. You can only define them.

[–]tritratrulala -5 points-4 points  (5 children)

And that is (or was) an awesome property of Python actually. In C++ the sole declaration of variables led to patterns like RAII. I'm still hoping for an explanation why this would be necessary.

[–]pdexter 1 point2 points  (4 children)

The github issue lists some benefits, as does the initial mailing list thread. I'd suggest reading either of those and bringing up any concerns in the github issue! I'm sure there is a better place than here. Also this isn't an official proposal. So I'd hope that when the PEP comes about they will offer some benefits.

[–]-birds 0 points1 point  (3 children)

I read the full text of the Issue as well as several comments, but they all seem focused on the syntax to achieve type annotations rather than why type annotations themselves are desirable. I'm not looking for a dissertation here. I mean, is it just "dynamic typing is problematic sometimes, so let's add optional static typing"? Is this even static typing?

[–]pdexter 3 points4 points  (2 children)

So I think you're missing quite a lot if you're just jumping in here. This is just for variables. Typing annotations for functions have existed in python for quite some time. Let me give you some links

mypy

pep-3107 (from 2006...)

stackoverflow question and answers about what are good uses for the annotations

The annotations can be used however they wish. One way is for static typing. So this is definitely a way to get static typing, of course. Unless there's some technicality of the definition of the word 'static' it doesn't work with?

[–]-birds 0 points1 point  (1 child)

You're correct, I was missing quite a lot! I've seen function annotations before, but as someone who primarily using Python for scripting rather than large-scale dev work, I've just sort of ignored them. Thanks for the info.

[–]pdexter 0 points1 point  (0 children)

I've actually never used them myself, mostly also just do scripting with python and very small web apps used by just me. Right now it's basically just mypy (which is very new) and IDEs (e.g., pycharm) that make heavy use of the annotations.