[Python-3000] Set literal
Adam Olsen
rhamph at gmail.com
Sun Jan 27 04:50:36 CET 2008
On Jan 24, 2008 9:12 PM, Guido van Rossum <guido at python.org> wrote:
> 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.)
Given that "x in {1,2,3}" can be optimized just as well with mutable
sets (can somebody think of an example that can't?), do you still
support immutable using the literal notation?
--
Adam Olsen, aka Rhamphoryncus
More information about the Python-3000
mailing list