Python: determine if EDA_OBJECTs refer to the same object?

In the development of KiCommand, it would be useful to determine if two python objects refer to the same EDA_OBJECT. Apparently, when objects are retrieved from pcbnew using python, a new python SWIG object is created, even when referring to the same EDA_OBJECT.

How can I determine if the python object refers to the same EDA_OBJECT?

For example, in KiCommand (which uses python under the hood) if I execute the following, I get two python SWIG objects that refer (I think) to the same pad:

clear modules getpads 0 index list pads 0 index append copy print GetParent call refobj textfromobj print swap GetName call print

[<pcbnew.D_PAD; proxy of <Swig Object of type 'D_PAD *' at 0x0000000004e80e40> >, <pcbnew.D_PAD; proxy of <Swig Object of type 'D_PAD *' at 0x0000000004e80750> >] 
[u'P5', u'P5'] 
[u'2', u'2']

This shows different Swig Objects (…e40 and …750) yet have the same name (‘2’) and the same parent module name (‘P5’).

It would be nice if the EDA_OBJECT has some type of unique ID. What is the best way to determine if the Swig Objects are referring to the same EDA_OBJECT?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.