
Oct. 7, 2011
10:36 a.m.
2011/10/7 Jakob Bowyer <jkbbwr@gmail.com>:
Looking at this from a Math background, it seems that it would be nice for the set type to support multiplication. This would allow for the multiplication of sets to produce Cartesian products giving every single permutation. This would make set usage more intuitive for example; (assuming python3)
a = set(["amy", "martin"]) b = set(["smith", "jones", "john"]) c = a * b print(c) set([('john', 'jones'), ('john', 'martin'), ('jones', 'john'), ('martin', 'amy'), ....])
Is your example correct? It does not look like a cartesian product to me. and what about writing it this way: {(x,y) for x in a for y in b} -- Amaury Forgeot d'Arc