Clarifying documentation of typing.Set
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 36k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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.)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit den Docstrings für typing.Set und collections.abc.Set und vergleichen Sie anschließend die zugehörige Dokumentation zu generischen Aliasen sowie die Hinweise in PEP 585. Als erledigt gilt die Aufgabe, wenn die Dokumentation Leser von typing.Set ohne den zusätzlichen Zwischenschritt zu collections.abc.Set weiterleitet und klar erklärt, wann builtins.set verwendet werden sollte.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100