When writing Salome scripts that include a step to explode objects to their sub-shapes (using ExtractShapes) it is worth paying attention to the isSorted parameter, which is True by default. In my experience this parameter is best set to False in order to avoid Salome unpredictably changing the order of the objects in the resulting list.
For example, here I have a Compound of two objects A and B, which has the faces glued resulting in Glue_1. I want to extract the two solids and use them in the script.
[Solid_1,Solid_2] = geompy.ExtractShapes(Glue_1, geompy.ShapeType["SOLID"], False)
I found that, when isSorted was True, sometimes Solid_1 was A and sometimes it was B. This is obviously detrimental to my script operating correctly further down the line.
Therefore I recommend always setting the parameter to False, so that the order stays the same. Trust me; a number of times I overlooked this and spent a number of hours scratching my head, trying to work out why my script was working sometimes and failing other times. Those kinds of “bugs” can be very frustrating!