comparing values in separate tuples

 a = mesh.verts[0].co
b = mesh.verts[1].co

if a == b:
   print 'match'

Always returns false, but

 a = mesh.verts[0].co
b = mesh.verts[1].co

if a[0] == b[0] and a[1] == b[1] and a[2] == b[2]:
   print 'match'

works.

If I’m understanding correctly, the first is comparing the pointer values of the coordinate tuples, which point to different locations in memory, while the second example actually compares the x y z values. How do I do a simple compare (if a == b) to where it looks at the underlying values?

the comparison operator ‘==’ is defined by the type of object. Each object must override the comparison operator in it’s object protocol for this to define a return value. co i think is a vectorType which does not define a comparison operator in it’s object protocol.

Maybe that would work:

 a = tuple(mesh.verts[0].co)
b = tuple(mesh.verts[1].co)

if a == b:
   print 'match'

Martin