RepugNaNt [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Wed 2011-12-07 15:45
RepugNaNt
LinkReply
[personal profile] simontWed 2011-12-07 16:35
Indeed, a quick test confirms that viewitems() answers queries of this type quickly as I'd expected. I just did this:
>>> d = dict([(i,i*i) for i in range(1000000)])
>>> (5,47) in d.viewitems()
False
>>> (5,47) in d.items()
False
and there was a delay of a second or so when constructing the dictionary in the first place, and when testing via items(), but testing via viewitems() was instant.
Link Reply to this | Parent
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]