In article <f11e1bba-3846-41c0-a789-5fc799335...@p12g2000prn.googlegroups.com>, Raymond Hettinger <pyt...@rcn.com> wrote: >On Aug 29, 12:12=A0pm, John Nagle <na...@animats.com> wrote: >> >> Is the "in" test faster for a dict or a set? Is "frozenset" faster >> than "set"? Use case is for things like applying "in" on a list of >> 500 or so words while checking a large body of text. > >There is no significant difference. All three are implemented using >substantially the same code.
That reminds me: one co-worker (who really should have known better ;-) had the impression that sets were O(N) rather than O(1). Although writing that off as a brain-fart seems appropriate, it's also the case that the docs don't really make that clear, it's implied from requiring elements to be hashable. Do you agree that there should be a comment? -- Aahz (a...@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 -- http://mail.python.org/mailman/listinfo/python-list