Batuhan Taskaya wrote:
I think it looks very fine when you type {1, 2, 3} * {"a", "b", "c"} and get set(itertools.product({1, 2, 3}, {"a", "b", "c"})). So i am proposing set multiplication implementation as cartesian product.

I'm not sure this would be used frequently enough to justify making it
a built-in operation on sets. I can't think of any situation where I've
wanted to materialise a Cartesian product as an actual set object.
Usually I'm iterating over it and doing something else, and we already
have more flexible ways of doing that -- list comprehensions, nested
loops, etc.

Also, this would really only work sensibly for Cartesian products of
two sets, not three or more. Writing s1 * s2 * s3 wouldn't give you
a set of 3-tuples (a, b, c), but a set of 2-tuples ((a, b), c).
Mathematicians usually gloss over this distinction, but in programming
it becomes important.

--
Greg
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/R3E4TQLEMZCWEWMZXDEW3YQWBB27C65A/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to