[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Sorry Peter, > > Try this.... > > import unittest > import Numeric > > class myTest(unittest.TestCase): > def runTest(self): > var1 = Numeric.array([1,22]) > var2 = Numeric.array([1,33]) > self.assertEqual(var1,var2) > > if __name__ == '__main__': > unittest.main()
Try this interactively and you'll see why: >>> import Numeric >>> a=Numeric.array([1,22]) >>> b=Numeric.array([1,33]) >>> c = a==b >>> c array([1, 0]) >>> assert(c) i.e., thanks to element-by-element evaluation, == will generally return a true value for ANY comparison of Numeric arrays, causing a very frequent beginner's bug to be sure. Try Numeric.alltrue(c), or Numeric.allclose(a,b) ... Alex -- http://mail.python.org/mailman/listinfo/python-list