[Python-3000] sets in P3K?
Raymond Hettinger
rhettinger at ewtllc.com
Mon May 1 18:59:59 CEST 2006
>>>set() == set{}
>>>set(x) # No braced equivalent
>>>set([x]) == set{x} # Ignoring list comprehensions
>>>set((x,)) == set{x}
>>>set((a, b, c)) == set{a, b, c}
>>>
>>>
>>I would rather stick to what we have than introduce two notations for
>>construction, call, subscripting, etc. --- Perl's [] vs. {} *always*
>>causes headaches for newcomers.
>>
>>
>
>And last time I looked they were gonna change it for Perl 6.
>
>
>
Nick's syntax proposal represents some creative and original thinking on
the problem; however, I think all such proposals face a somewhat
difficult hurdle -- a change has to be weighed against the almost
microscopically small benefit provided by set literals. Accordingly, we
should reject any set literal proposal that results in complexifying the
grammar. While I would like to see some way of writing set literals, it
certainly isn't worth the dizzying effect produced by the examples shown
above.
IOW, I recommend saving your big guns (alternative constructor syntaxes)
for big problems whose solutions provide big rewards. Set literals are
barely worth the brain power that has already been expended in this
thread. If a set literal proposal isn't dirt simple, it is almost
certainly a mistake.
Raymond
More information about the Python-3000
mailing list