John Nagle <na...@animats.com> writes: > 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. > > John Nagle
IIRC Frozensets are implemented more or less as sets with a hash function and immutability so I would expect "in" to perform exactly the same as for sets. For dicts, I would think that the set implementation is very close to the dict one. So I wouldn't expect any significant difference between any of them. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list