What is the proper way to test the identity of two objects?
Usually I do this:
if ob1 == ob2:
Or if the references have become outdated, it may be safer to hold onto names and see if they still exist:
objects = bpy.data.objects
ob_a = objects.get(name_a)
if ob_a is not None:
ob_b = objects.get(name_b)
if ob_a == ob_b:
# found a match!
In Python, you're taught that equality is not the same as identity. Theoretically, there can be two indistinguishable Blender objects. So what I'd really like to do is test identity:
if ob1 is ob2:
However, in the Blender console:
C.object is C.object
False! Why is this so, and what is the recommended way for determining the identity of two objects?