[Python-3000] Set literal
Steven Bethard
steven.bethard at gmail.com
Fri Jan 25 08:33:44 CET 2008
On Jan 25, 2008 12:18 AM, Mark Summerfield <mark at qtrac.eu> wrote:
> On 2008-01-25, Guido van Rossum 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.
>
> So this will produce:
>
> frozenset() # empty frozen set
> {1} # 1 item frozen set
> {1, 2} # 2 item frozen set
> {} # empty dict
> {1:1} # 1 item dict
> {1:1, 2:2} # 2 item dict
>
> I think this is confusing and messy, especially for new Python programmers.
>
> If you're going to make the change, why not make things consistent:
>
> {} # empty frozen set
> {1} # 1 item frozen set
> {1, 2} # 2 item frozen set
> {:} # empty dict
> {1:1} # 1 item dict
> {1:1, 2:2} # 2 item dict
This has been discussed and rejected as it would break too much code.
Check the archives during the set literals discussions.
STeVe
--
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
More information about the Python-3000
mailing list