Message371694
Thanks, I am happy to submit a PR. Before I do, I'd like to discuss the subsection titles, starting from the arrangement in typing.__all__:
# Special typing constructs (source comment is: "Super-special typing primitives")
Any Callable ClassVar Final ForwardRef Generic Literal Optional Protocol Tuple Type TypeVar Union
In this section I propose we add:
- NamedTuple and TypedDict: source comments say "Not really a type" (for both), and I believe it's confusing to list them along the other collections. Tuple is already in the "Special constructs" category, so NamedTuple should follow in there. TypedDict is very different from the other collections, it's purely a type hinting construct with no runtime counterpart so it's pretty special IMHO.
- AnyStr: should be listed right after TypeVar, NoReturn, NewType
- Text, TYPE_CHECKING: I am not sure about those, but if they are removed from the "One-off things" all that remains are functions and decorators, which looks good.
# ABCs (from collections.abc) [Keep this title]
AbstractSet ByteString Container ContextManager Hashable ItemsView Iterable Iterator KeysView Mapping MappingView MutableMapping MutableSequence MutableSet Sequence Sized ValuesView Awaitable AsyncIterator AsyncIterable Coroutine Collection AsyncGenerator AsyncContextManager
# Concrete collection types [keep this title]
ChainMap Counter Deque Dict DefaultDict List OrderedDict Set FrozenSet
- Generator should go with "ABCs"
- NamedTuple TypedDict should go with "Special typing constructs"
# Protocols (source comment is "Structural checks, a.k.a. protocols.")
Reversible SupportsAbs SupportsBytes SupportsComplex SupportsFloat SupportsIndex SupportsInt SupportsRound
# Functions and decorators (source comment is "One-off things.")
cast final get_args get_origin get_type_hints no_type_check no_type_check_decorator overload runtime_checkable
- AnyStr NewType NoReturn: these should go with "Special typing constructs"
- Text TYPE_CHECKING: either go with "Special typing constructs" or a constants section, which could include AnyStr as well
There are also the IO and re types which could have their own subsections.
Looking forward for feeback on this. Thanks! |
|
Date |
User |
Action |
Args |
2020-06-16 20:05:57 | ramalho | set | recipients:
+ ramalho, rhettinger, docs@python |
2020-06-16 20:05:57 | ramalho | set | messageid: <1592337957.19.0.647424634206.issue40979@roundup.psfhosted.org> |
2020-06-16 20:05:57 | ramalho | link | issue40979 messages |
2020-06-16 20:05:56 | ramalho | create | |
|