How do I compare two complex data structures?

Posted by Phil H on Stack Overflow See other posts from Stack Overflow or by Phil H
Published on 2010-05-04T10:44:30Z Indexed on 2010/05/04 10:48 UTC
Read the original article Hit count: 227

I have some nested datastructures, each something like:

[ ('foo', [ {'a':1, 'b':2},
                 {'a':3.3, 'b':7} ]),
  ('bar', [ {'a':4, 'd':'efg', 'e':False} ])   ]

I need to compare these structures, to see if there are any differences. Short of writing a function to explicitly walk the structure, is there an existing library or method of doing this kind of recursive comparison?

© Stack Overflow or respective owner

Related posts about python

Related posts about comparison