[Python-3000] Set literal

Jim Jewett jimjjewett at gmail.com
Fri Jan 25 04:20:12 CET 2008

On 1/24/08, Raymond Hettinger <python at rcn.com> wrote:
> [John Barham]
> > But getting back to the original issue, what does using
> > frozensets gain you over using a tuple:
> >
> > if urlext in ('html', 'xml', 'php'):
> With sets, the search is O(1).
> With tuples, it is O(n).
> Sets win on inputs longer than 1.

I thought you tried changing those tuples to frozensets (because it
was semantically better), and found that it didn't actually win for
tuples of length 2 or 3.


More information about the Python-3000 mailing list