python / python/cpython

socket module documentation: confusing display of module functions vs class methods

Offen
#94,432 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

docs topic-socket
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
36k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

socket, the module contains socket, the class. In the documentation, the functions of the module are rendered in exactly the same way as the methods of the class: socket.getaddrinfo and socket.accept look 'the same' in the documentation, even though the latter is actually socket.socket.accept. The only clue to that is the paragraph at the beginning of the section, but when e.g. linking to a particular method, that's easy to miss, and the user is left to infer that from the method description (or realise they have to scroll up/which section they're in).

The docs consistently use module.func for module-level functions and class.func for the methods of module.class. That style's fine most of the time and avoids the potential visual overload of always writing module.class.func. Naturally, the confusion arises only because the module and class have the same name in this particular case.

I'm not sure how to best resolve this, but I feel like the current situation is certainly not ideal.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem im Issue verlinkten Dokumentationsabschnitt zum socket-Modul und vergleiche die Darstellung von socket.getaddrinfo mit socket.socket.accept. Ermittle eine klarere Möglichkeit, Funktionen auf Modulebene von Klassenmethoden zu unterscheiden, ohne den übergreifenden Dokumentationsstil zu ändern; als erledigt gilt die Aufgabe, wenn Leser das zugehörige Objekt anhand der gerenderten Dokumentation und direkter Links identifizieren können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.