-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-99304: [Enum] clarify what constitutes a flag alias #99395
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Some low-level suggestions, and a couple high-level questions:
-
Shouldn't there be a
.. versionchanged
notice stating that the behavior of listing alias flags when iteratingFlag
enums was changed in 3.11? Per my testing, aliases for Flag enums are listed in 3.10 and before, but not in 3.11, and I can't find that explicitly noted anywhere in aversionchanged
, at least that I can find. -
Conversely, I can't seem to reproduce a change in the
Flag
inversion behavior comparing 3.11/3.12 with 3.10 or 3.9; all the previous versions had the same behavior stated here, as far as I could tell. The following is on Python 3.9:>>> from enum import Flag, auto >>> class Color(Flag): ... RED = auto() ... GREEN = auto() ... BLUE = auto() ... >>> purple = Color.RED | Color.BLUE >>> white = Color.RED | Color.GREEN | Color.BLUE >>> ~white <Color.0: 0> >>> ~purple <Color.GREEN: 2> >>> ~Color.RED <Color.BLUE|GREEN: 6>
Aside from the very small difference in the repr of
white
, this duplicates the 3.11+ results exactly, as far as I can tell. I get the same result on 3.10, too. Is there something I'm missing here?
@CAM-Gerlach Wow, a thousand thanks for that review! I added a version change note for the aliases, and negative numbers on inversion was an If you could double-check the last couple changes I would be grateful! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some similar fixes as above, otherwise LGTM. Thanks @ethanfurman !
Just FYI, if you want to avoid individually committing every suggestion, you can go to the |
3817b46
to
8bfb7e8
Compare
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
8bfb7e8
to
adec201
Compare
Thanks @ethanfurman for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
…H-99395) (cherry picked from commit 73a921b) Co-authored-by: Ethan Furman <[email protected]> Co-authored-by: C.A.M. Gerlach <[email protected]>
GH-99415 is a backport of this pull request to the 3.11 branch. |
…) (GH-99415) gh-99304: [Enum] clarify what constitutes a flag alias (GH-99395) (cherry picked from commit 73a921b) Co-authored-by: Ethan Furman <[email protected]> Co-authored-by: C.A.M. Gerlach <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.