object doesn't have an __enter__/__exit__ yet docs say it does
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 36k
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 558
Beschreibung
Documentation
Here's the current docs in the Python data model on object.__enter__:
object.__enter__(self)
And object.__exit__:
object.__exit__(self, exc_type, exc_value, traceback)
However, with Python 3.10.3, we see neither of these methods belong to object:
>>> object.__enter__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'object' has no attribute '__enter__'. Did you mean: '__ne__'?
>>> object.__exit__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'object' has no attribute '__exit__'. Did you mean: '__init__'?
I think the docs could be:
- More clear that
__enter__and__exit__are not methods onobject - Mention where they come from (just being defined within your object to match the interface)
Thank you for your consideration!
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
Beginne mit den im Issue verlinkten Abschnitten der Python-Datenmodelldokumentation zu object.enter und object.exit und überprüfe ihre aktuelle Formulierung anhand von Python 3.10.3. Aktualisiere die Dokumentation, um klarzustellen, dass diese Methoden nicht in object definiert sind, und erkläre, dass Kontextmanagerobjekte sie definieren, um die Schnittstelle bereitzustellen; abgeschlossen ist die Aufgabe, wenn das dokumentierte Verhalten mit dem Verhalten zur Laufzeit übereinstimmt.
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
- Klar beschrieben
- Anfängerfreundlichkeit
- 48/100