EnumType __call__ method description does not match the implementation
Offen
@ethanfurman arbeitet bereits daran.
Seit 17.5.2024.
docs
stdlib
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Documentation
See EnumType.call documentation, where the prototype is:
__call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
While in the enum.py source code there is:
def __call__(cls, value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None):
-
The
_not_givenhelper behaves differently thanNone, which even breaks compatibility with previous versions (this change was introduced in 3.12.3), when one needs to do some customization of enum metaclass.- e.g. as propsed on the stack overflow to implement enum item deprecation warning - note that this implementation stops working in 3.12.3 since the call of the parent
EnumType.__call__passesNoneinstead of_not_givenand it causes different behavior.
- e.g. as propsed on the stack overflow to implement enum item deprecation warning - note that this implementation stops working in 3.12.3 since the call of the parent
-
Note
*vs.*values, which I believe even behaves differently.
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.
Bewertung
Dieses Issue wurde noch nicht bewertet.