Everyone.
I've come into a strange problem where when I try to compare two identical lists, Python (2.7) determines that they are disparate. They are embedded in a rather large body of code, but here is small piece of it.
print("innersearch:",innersearch)
print("innersub:",innersub)
if (innersearch == innersub):
print("innersearch = innersub")
print("----")
Unfortunately, this returns:
innersearch: (-100.00,-0.00)
innersub: (-100.00,-0.00)
----
I know this is a modal issue, because when I replace innersearch
and innersub
with (-100.00,-0.00)
for both, I get innersearch = innersub
. Any help is appreciated, and apologies for my lack of knowledge.
UPDATE:
It was suggested that I round the values, as they had been when outputted before comparing them, and, unfortunately, this did little to help.
innersub = turtle.Vec2D(round(innersub[0], 2), round(innersub[1], 2))
innersearch = turtle.Vec2D(round(innersearch[0], 2), round(innersearch[1], 2))
print("innersearch:",innersearch)
print("innersub:",innersub)
if (innersearch == innersub):
print("innersearch = innersub")
print("----")
And this returned the same. Any ideas?