[Python-3000] Empty set and empty dictionary

Josiah Carlson jcarlson at uci.edu
Mon Apr 16 18:16:35 CEST 2007


"Neville Grech" <nevillegrech at hotmail.com> wrote:
> This is just some syntax sugar:
> 
> Since set literals will change to for example {1,2,3} from set([1,2,3])
>  and set comprehensions will be specified inside {} I feel that {}
> will be more naturally associated with sets than dicts (or at least
> as much).
> 
> What if the empty set literal is changed to {} and an empty dict
> literal changed to {:}. Performing the conversion automatically
> wouldn't be so complex and also un-ambiguous. The hardest thing to
> change would be the mentality then.

Because the mentality would be so difficult to change, and because sets
are still used less frequently than dicts, it doesn't make sense to
alter dictionary syntax (that people have used for over a decade) for
sets (which don't yet have a literal syntax in a released Python).

Your heart is in the right place, but your logic is jumping the gun by
a while.  Offer the suggestion after the syntax has been available in a
released Python for at least a year, when everyone has a chance to use
set syntax.

 - Josiah



More information about the Python-3000 mailing list