Clarifying documentation of typing.Set
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
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.Setit states "To annotate arguments it is preferred to use an abstract collection type such as AbstractSet." This is referring totyping.AbstractSet - Docstring of
typing.AbstractSetsays 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.Setand direct the reader to the final destination i.e.typing.Set -> collections.abc.Set.
Suggested change
typing.Setshould 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.Setis deprecated since version 3.9:builtins.setnow supports[]. SeePEP 585andGeneric Alias Type"
- Docstring of
typing.AbstractSetis fine as it is. collections.abc.Setshould 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.)
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece pelas docstrings de typing.Set e collections.abc.Set e, em seguida, compare a documentação relacionada sobre aliases genéricos e as orientações da PEP 585. Considera-se concluído quando a documentação direcionar os leitores de typing.Set para collections.abc.Set sem a etapa intermediária extra e explicar claramente quando usar builtins.set.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- documentation
- Tipo de issue
- Documentação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100