bearophileHUGS at lycos.com writes: > {x*x for x in xrange(10)} > {x:x*x for x in xrange(10)} I've always just used: set(x*x for x in xrange(10)) dict((x,x*x) for x in xrange(10)) I didn't even realize that you could write sets with {...}.