How to define enum values that are functions?
问题 I have a situation where I need to enforce and give the user the option of one of a number of select functions, to be passed in as an argument to another function: I really want to achieve something like the following: from enum import Enum #Trivial Function 1 def functionA(): pass #Trivial Function 2 def functionB(): pass #This is not allowed (as far as i can tell the values should be integers) #But pseudocode for what I am after class AvailableFunctions(Enum): OptionA = functionA OptionB =