At 01:55 PM 2/1/2006 -0500, Greg Wilson wrote: >I have a student who may be interested in adding syntactic support for >sets to Python, so that: > > x = {1, 2, 3, 4, 5} > >and: > > y = {z for z in x if (z % 2)} > >would be legal. There are of course issues (what's the syntax for a >frozen set? for the empty set?),
Ones that work now: frozenset(z for z in x if (z%2)) set() 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 (). _______________________________________________ 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