[Python-ideas] Support multiplication for sets

Raymond Hettinger raymond.hettinger at gmail.com
Fri Oct 7 19:59:56 CEST 2011


On Oct 7, 2011, at 6:24 AM, Jakob Bowyer wrote:

> 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. 

-1  We already have multiple ways to do it (set comprehensions, itertools.product, ...).  Also, it's much nicer to have an iterator than to fill memory with lots of little sets.

Also, it is unclear what s*s*s should do.  Probably, the user would expect {(a,a,a), (a,a,b), ..} but the way you've proposed it, they would get {((a,a),a), ((a,a),b), ...} and have an unpleasant surprise.


Raymond


More information about the Python-ideas mailing list