[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-30 Thread Thomas Jollans
On 25/07/2019 19.41, Andrew Barnert via Python-ideas wrote: > On Jul 25, 2019, at 09:46, 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

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-27 Thread Ethan Furman
On 07/27/2019 03:17 AM, Batuhan Taskaya wrote: Its more clear and understandable than itertools.product for people from outside of a programming background. The simplicity is useful when we are working with multiple expressions at sametime. (cset(a & b) * cset(a | b)) So build that

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-26 Thread Guido van Rossum
IMO if you need the concrete Cartesian product instantiated you're probably doing something wrong, or you're addicted to a certain kind of programming competitions with highly mathematical puzzles. itertools.product() is good enough for the occasional legitimate use case (I think I recall

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-26 Thread Batuhan Taskaya
Python is for simplicity. It would be really cool to do such shortcuts instead of import itertools; itertools.product everytime. On Fri, Jul 26, 2019 at 2:55 PM Greg Ewing wrote: > Andrew Barnert via Python-ideas wrote: > > The usual set-theoretic definition of tuples is just recursively as >

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-26 Thread Greg Ewing
Andrew Barnert via Python-ideas wrote: The usual set-theoretic definition of tuples is just recursively as ordered pairs: () is 0, (a) is a, (a, b) is , (a, b, c) is <, c>, etc. So, you don’t have to gloss over anything; s1 * s2 * s3 gives you elements ((a, b), c), but those are identical to

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-25 Thread Andrew Barnert via Python-ideas
On Jul 25, 2019, at 14:57, Chris Angelico wrote: > >> On Fri, Jul 26, 2019 at 7:47 AM Greg Ewing >> wrote: >> >> 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

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-25 Thread Chris Angelico
On Fri, Jul 26, 2019 at 7:47 AM Greg Ewing wrote: > > 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. > >

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-25 Thread Greg Ewing
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

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-25 Thread Andrew Barnert via Python-ideas
On Jul 25, 2019, at 09:46, 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 think it might make more

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-25 Thread Batuhan Taskaya
And i know this is proposed before but it should be reconsidered under steering council. On Thu, Jul 25, 2019 at 7:46 PM 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