Re:PEP 584 – Add + and – operators to the built-in dict class
by sametmax on Wednesday March 06, 2019 @10:13AM
(#19319443)
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.
Re:PEP 584 – Add + and – operators to the built-in dict class
by klibertp on Wednesday March 06, 2019 @01:40PM
(#19321367)
> 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.
This is exactly why I want explicit typing in Python.