Why it is not advisable to use python 'is' statement for comparing objects in Abaqus/CAE.

Consider the following python commands for a model in Abaqus/CAE

>>p=mdb.models[‘Model1’].parts[‘Part1’]

>>e=p.edges

 

Now,

>>> e==p.edges

True

>>> e is p.edges

False

 

The reason why the latter statement returned false is that  the Python objects ('e' and 'p') in this case are wrappers to the "real" objects in Abaqus/CAE. They are actually instances of an internal 'pyo_Catalog Object', but the type is dynamically changed to reflect the wrapped object. So they are not in effect the same although dynamically they are updated. This makes the 'is' statement return False. The compare operator '==' has to be used always for making the comparison. This can also be verified by using id() method.