Raymond Hettinger wrote: > [Phillip J. Eby] > > The only case that looks slightly less than optimal is: > > > > set((1, 2, 3, 4, 5)) > > > > But I'm not sure that it warrants a special syntax just to get rid of the > > extra (). > > The PEP records that Tim argued for leaving the extra parentheses. > What would you do with {'title'} -- create a four element set consisting > of letters or a single element set consisting of a string?
I think the answer to this one is clearly that it is a single element set consisting of a string, just as ['title'] is a single element list consisting of a string. I believe the confusion arises if Brett's proposal for ``set(1, 2, 3, 4, 5)`` is considered. Currently, set('title') is a five element set consisting of letters. But set('title', 'author') would be a two element set consisting of two strings? The problem is in calling the set constructor, not in writing a set literal. That said, I don't think there's really that much of a need for set literals. I use sets almost exclusively to remove duplicates, so I almost always start with empty sets and add things to them. And I'm certainly never going to write ``set([1, 1, 2])`` when I could just write ``set([1, 2])`. STeVe -- You can wordify anything if you just verb it. --- Bucky Katt, Get Fuzzy _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com