python / python/cpython

Add a "warning" option to enum.FlagBoundary

オープン
#99,999 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@ethanfurman がすでに取り組んでいます。

2022年12月5日 から。

stdlib type-feature
主要言語
Python
スター
77.2k
フォーク
36k
PR マージ指標
PR 指標を取得中

説明

Feature or enhancement

The new enum.FlagBoundary system seems quite nice, but there does not appear to be an option to accept a value (a.k.a KEEP) but warn when out of range (STRICT throws an error, and would require a second class to wrap the value).

Pitch

I see two possible options:

  1. Add a new flag (e.g. WARN or WARN_KEEP) which warns when the value is out of range
  2. Modify KEEP such that a warning is displayed when the value is out of range

(1) seems like the better option from a backwards-compatibility perspective, but (2) seems like the better option from a usability and maintenance perspective (as missing values are easier to spot).

Previous discussion

None

Linked PRs
  • gh-154501

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。