[Python-3000] Empty set and empty dictionary

Guido van Rossum guido at python.org
Mon Apr 16 18:33:45 CEST 2007


It's not stupid, but it's been brought up before (exactly like you
propose) and rejected, on the basis that dicts are still much more
common than sets in most code.

On 4/16/07, 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.
>
> i.e:
> {} ::= set([])
> {1,2,3} ::= set([1,2,3])
> {x for x in y} ::= set(x for x in y)
> {:} ::= dict()
>
> {a:b, h:j} is a dict since it contains colons.
>
> I hope this isn't a stupid suggestion (I'm new here).
>
> -Neville
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe:
> http://mail.python.org/mailman/options/python-3000/guido%40python.org
>
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list