Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> It very nice that dict and set are very distincts, and that they have a distint set of operators. This way it's super easy to scan the code and know what the data structure is, and what it's used for.

This is exactly why I want explicit typing in Python.



You do with type annotations.

But type declaration may not be in the view port.

Or you may read a script or snippet, which is a type or code that won't bother with typing.


> But type declaration may not be in the view port.

Type declaration doesn't have to be in the view; the very point of type annotations is to support static type systems, which you can query about any type. For example, if you use mypy, you can add `reveal_type( any_kind_of_expr )` anywhere in your code and you'll get the most precise type available, be it inferred or declared manually, for that expression at given point in code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: