In the first example,
a is b returns True as it should. In the second, it is False. (assume Blender is just opened and the default cube is present and selected). I thought I was starting to understand until I got
False. This is copied form the Python console.
>>> a = [1, 2, 3] >>> b = a >>> a == b True >>> a is b True >>> a = bpy.context.active_object.data >>> b = bpy.data.meshes[bpy.context.active_object.name] >>> a bpy.data.meshes['Cube'] >>> b bpy.data.meshes['Cube'] >>> type(a) <class 'bpy_types.Mesh'> >>> type(b) <class 'bpy_types.Mesh'> >>> a == b True >>> a is b False # WHY?
Another example based on @ideasman42 explanation...
>>> a = bpy.context.object >>> b = bpy.context.object >>> a is b False