On 20/12/2021 22:34, Serhiy Storchaka wrote:
20.12.21 21:28, Brett Cannon пише:
As someone with use of this, would you find this useful (i.e. +1, +0)? Serhiy already said "no" in another thread. In every file we import 5-10 or more names from the typing module. We still does not use PEP 585 and PEP 604 syntax, but are going to do this in near future. It could save as from importing List, Tuple, Dict, Set, Union, Optional, but we still need to import Any, Sequence, Iterable, Iterator, AsyncIterator, Awaitable, TypeVar, and sometimes AsyncContextManager, NewType, cast, overload. Special syntax for callable type hints will not save game. Sequence, Iterable, Iterator, AsyncIterator, Awaitable, AsyncContextManager are all in collections.abc not typing now. Of course it doesn't reduce total imports but it makes it less likely that you'll need to import typing.