Created
January 3, 2019 14:44
-
-
Save oyvinev/362a2f8be13e536323f700597ed42a4d 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
import enum | |
import operator | |
OperatorEnum = enum.Enum( | |
"operator", | |
{"==": operator.eq, ">=": operator.ge, "<=": operator.le, ">": operator.gt, "<": operator.lt}, | |
) | |
print(OperatorEnum["=="].value) | |
OperatorEnum["foo"] # pass | |
OperatorEnum.foo # Fails |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment