Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "warning" option to enum.FlagBoundary #99999

Open
aragilar opened this issue Dec 5, 2022 · 1 comment
Open

Add a "warning" option to enum.FlagBoundary #99999

aragilar opened this issue Dec 5, 2022 · 1 comment
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@aragilar
Copy link
Contributor

aragilar commented Dec 5, 2022

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

@aragilar aragilar added the type-feature A feature request or enhancement label Dec 5, 2022
@AlexWaygood AlexWaygood added the stdlib Python modules in the Lib dir label Dec 5, 2022
@ethanfurman
Copy link
Member

This is an interesting idea. Still thinking on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
3 participants