EnumType __call__ method description does not match the implementation
Open
@ethanfurman is already working on this.
Since May 17, 2024.
docs
stdlib
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.