Open
Description
Documentation
Edit: I added some more clarification.
Documentation of typing.Set is not entirely clear
The typing module's documentation currently requires two hops when the reader looks up typing.Set
.
- In the docstring of
typing.Set
it states "To annotate arguments it is preferred to use an abstract collection type such as AbstractSet." This is referring totyping.AbstractSet
- Docstring of
typing.AbstractSet
says that it is deprecated and refers the reader tocollections.abc.Set
, which has no docstring of its own (it is grouped together with the docstring ofcollections.abc.MutableSet
.
I feel we can prevent these two hops i.e.typing.Set --> typing.AbstractSet --> collections.abc.Set
and direct the reader to the final destination i.e.typing.Set -> collections.abc.Set
.
Suggested change
typing.Set
should say something like --
"To annotate arguments it is preferred to use an abstract collection type such as
collections.abc.Set
.
"To annotate everything else, the use oftyping.Set
is deprecated since version 3.9:builtins.set
now supports[]
. SeePEP 585
andGeneric Alias Type
"
- Docstring of
typing.AbstractSet
is fine as it is. collections.abc.Set
should say something like --
"Use this to annotate arguments. For all other annotations, use
builtins.set
, which now supported[]
. SeePEP 585
...
Other generic alias types like List, Tuple, FrozenSet etc. probably could use a similar change (IF others agree that this is something that needs to changed at all.)