[Python-3000] Empty set and empty dictionary

Neville Grech nevillegrech at hotmail.com
Mon Apr 16 13:12:11 CEST 2007

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.

{} ::= 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).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20070416/6cf865e9/attachment.html 

More information about the Python-3000 mailing list