[Python-3000] set literals

Andrew Koenig ark-mlist at att.net
Sat Jul 8 15:38:12 CEST 2006


> moreover, you can say a set is a "kind of" a keys-only dict. in fact,
> the first implementation of set used a dict, where the keys where the
> elements of the set, and their value was always True.

Or you could adopt the approach used by SETL: A dict is equivalent to a set
of 2-tuples.  In other words, {1:2, 3:4} could be defined as being
equivalent to {(1,2), (3,4)}, with the run-time system being responsible for
maintaining the information needed for efficient associative access.  Then
there's no question about the type of {}, because there's really only one
type.

No, I'm not serious; I think it would be too big a change.  But you have to
admit it's a cool idea :-)




More information about the Python-3000 mailing list