How to define enum values that are functions?
<p>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:</p>

<p>I really want to achieve something like the following:</p>

<pre><code>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 = functionB
</code></pre>

<p>So the following can be executed:</p>

<pre><code>def myUserFunction(theFunction = AvailableFunctions.OptionA):
   #Type Check
   assert isinstance(theFunction,AvailableFunctions) 

   #Execute the actual function held as value in the enum or equivalent
   return theFunction.value() 
</code></pre>