Re:A Failed Experiment with Python Type Annotations
by davesque on Tuesday June 11, 2019 @07:14PM
(#20160372)
The first point can be rather easily circumvented by using strings as forward references and it only takes a bit of googling to figure that out. The second doesn't seem remotely like a deal breaker to me. Half the reason for having type annotations is to provide a description of what a function or method does at a glance. This is idiomatic even in hardcore functional languages like Haskell. With return type inference, you don't get that benefit.
[ Parent
| on HN ]
Re:A Failed Experiment with Python Type Annotations
by cjwoodall on Wednesday June 12, 2019 @10:10AM
(#20164794)
It seems to me that type inference would be silly in this case. Type suggestion during mypy checks might be useful though.
Function x does not specify a type, but returns SomeHelpfulTypeString. We recommend you use that.
Put it behind a flag and call it a day. Maybe even have a way of requesting type suggestions for functions during development