2 ms·
They badly need to update the docs, then. Almost everything I see on that page does this: vec = [] # type: Vector[float] vec = [] # type: Iterable[Tuple[flo
by oblio 9y ago
They badly need to update the docs, then. Almost everything I see on that page does this:
vec = [] # type: Vector[float]
vec = [] # type: Iterable[Tuple[float, float]]
a = MyClass() # type: MyClass[int]
x = Foo() # type: Foo[int]
- icegreentea2 9y agoUgh that's because PEP 484 (which introduced 'proper' type hints) only introduced it for parameters and return types and implemented in Python 3.5. Type hinting bare variables was introduced with PEP 526 and implemented in Python 3.6. While I really like the concept of PEPs, and I think keeping original (like as they were written) PEPs around are the right thing to do, I do wish sometimes that Python did a better job at incorporating changes from PEPs into the core documentation once implemented.