[Python-3000] Set literal

Jim Jewett jimjjewett at gmail.com
Tue Jan 29 13:58:35 CET 2008

On 1/28/08, Guido van Rossum <guido at python.org> wrote:
> Please don't reopen this. There are good reasons for 'set' to be the
> default set type and 'frozenset' to appear like a poor cousin. For
> one, their naming. This was all reasoned out long, long ago, in Python
> 2.3 with the sets module.

In general, mutable sets are more useful.

I don't think that applies to the more specific use case of already
having members available when you create the set.

To rephrase:

The majority of uses need a mutable set that starts empty.
The majority of uses that start non-empty do not require mutability.

In fairness, most of the non-empty cases don't require hashability
either, so a mutable set remains an acceptable substitute.  The
question is whether an explicit set( ) around it to indicate
mutability (and the loss of hashability) is desirable.  (Today, we
need the longer frozenset to indicate the opposite, but I'll agree
that we don't need it often.)


More information about the Python-3000 mailing list