[Python-bugs-list] Error in dictionary comparison (PR#282)

Tim Peters tim_one@email.msn.com
Sun, 9 Apr 2000 01:10:14 -0400


[gpk@bell-labs.com]

This isn't a Python bug.  Plug in this variant of your equals() function to
see where you're getting off track:

def equals(a, b):
        assert a.d == b.d    # Note that this succeeds!

        ad = a.d.keys()
        ad.sort()
        print "a.d=", a.d, ad
        bd = b.d.keys()
        bd.sort()
        print "b.d=", b.d, bd

        x, y = Set(b).d, Set(a).d
        print x, y           # Note that these aren't what you think

        return Set(b).d == Set(a).d