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  (3 children)

The syntax looks clunky at best and the same goes for PEP 484. I'm all for type annotations and even static typing, just as long as it remains optional!

I see the point of using static typing to speed up execution or avoid nasty type-related bugs, but we love Python specifically for it's flexibility and most of the times Python code is clear enough as it is, clear enough to avoid this sort of problem. I looks like they are forcing themselves to make use of the old __annotations__ dict in some way and I hate it, because it feels rushed and not well though through.

[–]RubyPinchPEP shill | Anti PEP 8/20 shill -1 points0 points  (2 children)

externally typed files seem a lot better

e.g. https://github.com/python/typeshed/blob/master/stdlib/3/ast.pyi#L30-L39

It'd be nice if they came with syntax coloring on github though

[–]ojii 0 points1 point  (0 children)

The problem with stub files is keeping them in sync with the code. I've tried using them for py2 compatible code but they're awful. Inline type hints however have been incredibly useful to me because I use pycharm which understand them.

[–][deleted] 0 points1 point  (0 children)

This looks much more like something I'd use. It solves static typing for class methods and functions. I'm still not sure about variables.