<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">Considering any multiplication action on a set is illegal. I don't think it will confuse anyone who doesn't know what a set is mathematically. <div>
</div></span><br><div class="gmail_quote">On Fri, Oct 7, 2011 at 12:20 PM, Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 7 October 2011 11:37, Jakob Bowyer <<a href="mailto:jkbbwr@gmail.com">jkbbwr@gmail.com</a>> wrote:<br>
> There is that but from a math point of view the syntax a * b does make<br>
> sence.<br>
> Its slightly clearer and makes more sense to people from outside of a<br>
> programming background.<br>
<br>
</div>I'm not sure I'd agree, even though I come from a maths background.<br>
Explicit is better than implicit and all that...<br>
<br>
Even if it is slightly clearer to some people, I bet there are others<br>
(not from a mathematical background) who would be confused by it. And<br>
in that case, itertools.product is easier to google for than "*"...)<br>
And that's ignoring the cost of implementing, testing, documenting the<br>
change.<br>
<br>
Actually, just to give a flavour of the sorts of design decisions that<br>
would need to be considered, consider this:<br>
<br>
>>> a = set((1,2))<br>
>>> b = set((3,4))<br>
>>> c = set((5,6))<br>
>>> from itertools import product<br>
>>> def times(s1,s2):<br>
...    return set(product(s1,s2))<br>
...<br>
>>> times(a,times(b,c))<br>
{(1, (3, 6)), (2, (3, 5)), (2, (4, 5)), (1, (4, 6)), (1, (4, 5)), (2,<br>
(3, 6)), (2, (4, 6)), (1, (3, 5))}<br>
>>> times(times(a,b),c)<br>
{((2, 4), 6), ((1, 4), 5), ((1, 4), 6), ((2, 3), 6), ((1, 3), 6), ((2,<br>
3), 5), ((2, 4), 5), ((1, 3), 5)}<br>
>>><br>
<br>
So your multiplication isn't commutative (the types of the elements in<br>
the 2 expressions above are different). That doesn't seem intuitive -<br>
so maybe a*b*c should be a set of 3-tuples. But how would that work?<br>
The problem very quickly becomes a lot larger than you first assume.<br>
<br>
Operator overloading is used much more sparingly in Python than in,<br>
say, C++. It's as much a language style issue as anything else.<br>
<br>
Sorry, but I still don't see enough benefit to justify this.<br>
<font color="#888888"><br>
Paul.<br>
</font></blockquote></div><br>