Hello,

I'm trying to use Rdata as dictionary keys, but I'm having some issues:

>>> import dns.resolver
>>> a = dns.resolver.query('www.example.com', 'A')
>>> rr1 = a.rrset[0]
>>> a = dns.resolver.query('www.example.com', 'A')
>>> rr2 = a.rrset[0]
>>> rr1 == rr2
True
>>> rr1 is rr2
False
>>> l = { rr1: True }
>>> rr1 in l
True
>>> rr2 in l
False
>>> rr1 in l.keys()
True
>>> rr2 in l.keys()
True

I would expect all of the "in" tests above to be True, but I rr2
doesn't seem to match.  The python documentation states that equality
tests (as opposed to identity tests) are used for membership tests in
sequences [1].  I assumed the same for dicts, but apparently that's
not so?  Or am I missing something?

Any ideas are greatly appreciated.

Regards,
Casey

[1] http://docs.python.org/reference/expressions.html#membership-test-details
_______________________________________________
dnspython-users mailing list
[email protected]
http://howl.play-bow.org/mailman/listinfo.cgi/dnspython-users

Reply via email to