python / python/cpython

EnumType __call__ method description does not match the implementation

Đang mở
#119,110 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@ethanfurman đang làm issue này rồi.

Từ ngày 17/5/2024.

docs stdlib
Ngôn ngữ chính
Python
Star
77.2k
Fork
36k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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):
  1. The _not_given helper behaves differently than None, 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__ passes None instead of _not_given and it causes different behavior.
  2. Note * vs. *values, which I believe even behaves differently.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.