Add Object Comparisons to ArcPy Mapping Objects

Idea created by achapkowski-esristaff Employee on Jan 3, 2013
    New
    Score10
    When comparing the data driven page dataFrame object to a list of data frames in a map document, you should be able to compare the two objects using the comparison method 'is'.  

    Example:
       dfs = arcpy.mapping.ListDataFrames(mxd)
       ddp = mxd.dataDrivenPages
       for df in dfs: 
          print df is ddp.dataFrame # always returns false
          print df == ddp.dataFrame # always returns false

    Since you are listing all data frames in a single map document as object DFS, at least one true value should be printed to correctly identify which object in the list is the parent object.  Currently you have to compare the properties of each object to see if they are equal or the same object.

    I believe the __cmp__ and the __eq__ methods should be extended to include this functionality.

    As a note, if you use the id() method on both the matching dataframe object and the data driven page object, they have two seperate memory ids.  I would have thought they should have been the same.