On Wed, 18 Nov 2015 11:40 pm, Chris Angelico wrote: > On Wed, Nov 18, 2015 at 10:37 PM, Steven D'Aprano <st...@pearwood.info> > wrote: >> How about Python 3? Python 3 has the advantage of using set literals. > > 2.7 has set literals too.
Ah, so it does. I forgot about that. Most of my code has to run on multiple versions (back to 2.4) and I remembered that set literals don't work: [steve@ando ~]$ python2.6 -c "{1, 2, 3}" File "<string>", line 1 {1, 2, 3} ^ SyntaxError: invalid syntax > All the questions of performance should be > secondary to code clarity, though; "All"? Surely not. > so I would say the choices are: Set > literal if available, else tuple. Forget the performance. It seems rather strange to argue that we should ignore performance when the whole reason for using sets in the first place is for performance. -- Steven -- https://mail.python.org/mailman/listinfo/python-list