[Tutor] Performance difference, ``in'' vs ``has_key()''

jfouhy@paradise.net.nz jfouhy at paradise.net.nz
Mon Jul 18 00:07:59 CEST 2005


Quoting Bill Campbell <bill at celestial.net>:

> I'm going to be doing some work where I'll be doing existence
> testings on keys on about a million records where it may require
> multiple passes so I'm a bit concerned about the timing of these
> tests.

If you're just doing existence testing, is it an option to use a set? (builtin
to Python 2.4)

I admit, I don't know how it performs.  But it would seem the most appropriate
of the builtin data structures.

-- 
John.


More information about the Tutor mailing list