What is the best way to store a list of functions?
<p>I need to store a large numbers of functions rules in Python (around 100000 ), to be used after....</p>

<pre><code>def rule1(x,y) :...
def rule2(x,y): ...
</code></pre>

<p>What is the best way to store, manage those function rules instance into Python structure ? </p>

<p>What about using Numpy dtype=np.object array ?
(list are bad when they become too large...)</p>

<p>Main goal is to access in the fastest and minimum memory footprint when storing in memory.</p>

<p>Thanks</p>

<p>Functions are first class objects in Python - you can store them just like you'd store any other variable or value:</p>

<pre><code>def a():
  pass

def b():
  pass

funcs = [a,b]
funcs[0]() # calls `a()`.
</code></pre>

python