Created
June 17, 2020 17:59
-
-
Save whardier/7e3623b2d340b7abe7bfd46ec41a511a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from enum import Flag, auto | |
>>> class Thing(Flag): | |
... left = auto() | |
... right = auto() | |
... middle = left | right | |
... | |
>>> Thing.middle | |
<Thing.middle: 3> | |
>>> Thing(3) | |
<Thing.middle: 3> | |
>>> Thing(2) | |
<Thing.right: 2> | |
>>> Thing(1) | |
<Thing.left: 1> | |
>>> Thing(0) | |
<Thing.0: 0> | |
>>> Thing(-1) | |
<Thing.middle: 3> | |
>>> Thing(-2) | |
<Thing.right: 2> | |
>>> Thing.left | Thing.right | |
<Thing.middle: 3> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment