Understanding a factorial function in python
<p>I'm trying to understand if the following Python function:</p>

<pre><code>def factorial(i):
    if not hasattr(factorial, 'lstFactorial'):
        factorial.lstFactorial = [None] * 1000
    if factorial.lstFactorial[i] is None:
        iProduct = 1
        for iFactor in xrange(1, i+1):
            iProduct *= iFactor
        factorial.lstFactorial[i] = iProduct
    return factorial.lstFactorial[i]
</code></pre>

<p>would produce the same results as the equivalent in C#:</p>

<pre><code>long factorial(long n) 
{ 
   return n &lt;= 1 ? 1 : n * factorial(n-1);
}
</code></pre>

<p>for a value of 12 or less.</p>

<p>I know nothing about Python but have just converted some Python code to C#. This was the only function that I didn't fully understand.</p>
