[Python-3000] sets in P3K?

Michael Urman murman at gmail.com
Wed May 3 15:43:45 CEST 2006


On 5/3/06, Greg Wilson <gvwilson at cs.utoronto.ca> wrote:
>     Type    Two elements        One element        Empty
>     List    [1, 2]              [1]                []
>     Dict    {1:'a', 2:'b'}      {1:'a'}            {}
>     Set     {1, 2}              {1}                set()

You left off Tuple, perhaps because it also broke the simple pattern:
      Tuple   1, 2                (1,)               ()

Still I see no reason to repeat the confusion to save one pair of
braces (square or parenthetical). Starting the language over I could
see making {:} and {} the empty dict and set respectively, but not
with the history Python has.

If people are dead set on a set literal, why not look further, to
atrocities like <1,2>, <1>, <>; @{1,2}, @{1}, @{}; {{1,2}}, {{1}},
{{}}; etc.? I know there has been resistance to grouped <> before (not
for sets), but I can't remember why.

Michael
--
Michael Urman  http://www.tortall.net/mu/blog


More information about the Python-3000 mailing list