4 Mar
2021
4 Mar
'21
2:24 a.m.
Am 03.03.21 um 18:36 schrieb henbruas@gmail.com:
Sebastian Rittau wrote:
Use built-in generics instead of the aliases from typing. Yes:: def foo(x: type[MyClass]) -> list[str]: ...
No:: from typing import List, Type
def foo(x: Type[MyClass]) -> List[str]: ...
But:: from typing import Iterable
def foo(x: Iterable[str]) -> None: ... According to PEP585, importing collection types from typing is deprecated, so wouldn't it be better to recommend importing things like Iterable from collections.abc?
Good point! I will update the PEP. - Sebastian