For the record, I'm thinking Raymond has won this argument fair and square, and I'm withdrawing my opposition.
I hope it isn't too confusing that {1: 1} creates a *mutable* dict while {1} creates an *immutable* frozenset. I still find this slightly inelegant. But the practicality of being able to treat set literals as compile-time constants wins me over. (I suspect for a 2-element set of ints or strings, translating "x in {C1, C2}" into "x in (C1, C2)" might actually be a slight win since probing a tuple must be much faster than probing a set; but that's a detail.) --Guido On Jan 24, 2008 7:56 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Jim Jewett] > > 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. > > The sets were faster. The automatic transformation didn't > go in because it changed semantics -- the searched for item > would need to be hashable -- the tuple search only requires > an equality test. > > > Raymond > _______________________________________________ > Python-3000 mailing list > Python-3000@python.org > http://mail.python.org/mailman/listinfo/python-3000 > Unsubscribe: > http://mail.python.org/mailman/options/python-3000/guido%40python.org > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com