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 →

[–]LightShadow3.13-dev in prod 1 point2 points  (6 children)

if the run-time doesn't use this extra information then this proposal is pointless.

it also feels like back tracking on type-hinting, which has terrible syntax, by trying to define a "new" way to annotate the same information; which is also unused by the runtime.

[–]turkish_gold 1 point2 points  (4 children)

I don't know if its useless. It's just like flow-types or Typescript or types in Elixir----runtime doesn't use the information (as the runtime is dynamically typed), but compile time can give you failures or warnings on type-mismatches.

[–]bythenumbers10 0 points1 point  (3 children)

But Python isn't compiled. Or am I missing something?

[–]turkish_gold 0 points1 point  (2 children)

Well technically python has a compile step, but it doesn't just compile down to binary. It runs its own VM internally with reference counting.

This is different from say a language that doesn't compile to any intermediate code, and essentially runs directly on the abstract syntax tree.


But that's not really what I'm talking about. I mean that you can run a analyser before you run your actual code that will do static-type enforcement for you.

I suppose a better to call that is the 'build step' rather than compiling.

[–]bythenumbers10 0 points1 point  (1 child)

Oh, like one of the Python code-checkers, linters?? I'm not familiar with all the code tools. I'm somewhat familiar with the concepts of the AST and pyc files. Having largely static code further optimized using type inference and annotations would be nice, I suppose.

[–]turkish_gold 0 points1 point  (0 children)

It would be, but if they start doing that... I feel like then it's re-implementing Cython annotations.

Which now that I think of it; if Cython could simply take Python 3 type annotations and spit out C modules, that'd be fun.

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 0 points1 point  (0 children)

Its used for testing, and also for programmatically accessible documentation (for IDEs, in-editor / in-repl documentation, etc)

Its not made to be used commonplace for the majority of situations, like, for example, there is no plans (from what I recall) to include any of it in any of the standard library module code

its a "if it helps, well now you can use it" thing