<span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">Hey everyone, I am extremely stumped on this. I have 2 functions..<br><br>def _determinant(m):<br>   return m[0][0] * m[1][1] - m[1][0] * m[0][1]<br>
<br>def cofactor(self):<br>   """Returns the cofactor of a matrix."""<br>   newmatrix = []<br>   for i, minor in enumerate(self.minors()):<br>       newmatrix.append(_determinant(minor.matrix) * ((i%2) * -1))<br>
   return newmatrix<br><br>And I get the following error when I try to run a.cofactor()...<br><br>"NameError: global name '_determinant' is not defined"<br><br>When I put the _determinant function nested within the cofactor function it works fine. Normally I would do this, but a lot of other methods use the _determinant method. They are both in the same class, and they are at the same level, they are even in that order so I know it should be  able to see it. I have a lot of functions that call other functions in this class and everything is fine. [Also for the picky, I know my cofactor method isn't mathematically correct yet ;-) ] Am I missing something obvious here? Also if it helps the rest of the code is here<a href="http://github.com/dlocpuwons/pymath/blob/d1997329e4473f8f6b5c7f11635dbd719d4a14fa/matrix.py">http://github.com/dlocpuwons/pymath/blob/d1997329e4473f8f6b5c7f11635dbd719d4a14fa/matrix.py</a> though it is not the latest.</span><br>