Performance: sets vs dicts.

Aahz aahz at pythoncraft.com
Mon Aug 30 19:42:11 EDT 2010


In article <878w3ogpvq.fsf at benfinney.id.au>,
Ben Finney  <ben+python at benfinney.id.au> wrote:
>aahz at pythoncraft.com (Aahz) writes:
>>
>> That reminds me: one co-worker (who really should have known better ;-)
>> had the impression that sets were O(N) rather than O(1).
>
>For settling exactly this kind of confusion, Python's standard library
>comes with a module, the timeit module. Your co-worker should have
>known better: don't guess about timing performance, measure it.
>
>Or am I missing something here?

Possibly; IMO, people should not need to run timeit to determine basic
algorithmic speed for standard Python datatypes.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"...if I were on life-support, I'd rather have it run by a Gameboy than a
Windows box."  --Cliff Wells



More information about the Python-list mailing list