sequence multiplied by -1

Antoon Pardon Antoon.Pardon at rece.vub.ac.be
Mon Oct 4 07:40:06 EDT 2010


On Sat, Oct 02, 2010 at 04:38:16AM +0000, Steven D'Aprano wrote:
> On Fri, 01 Oct 2010 10:24:11 -0700, Carl Banks wrote:
> 
> > On Sep 26, 8:20 am, Grant Edwards <inva... at invalid.invalid> wrote:
> [..]
> >> So now I suppose "+" for string concatenation is a bad thing.
> > 
> > Yes.  It's not the end of the world, but a separate concatenation
> > operator would have been better.  Then there's no temptation to special
> > case a failure of sum(list_of_strings), because it's not a sum any more.
> 
> I'll give you the case of sum, and I'll admit that I've often thought 
> that concatenation should be written & rather than +, but I wonder how 
> much difference it would really make?
> 
> If we wrote s & t for concatenation instead of s + t, would people now be 
> bitching that it uses the same operator as bitwise-and?

Possibly. It would depend on the fact if there are people in need for
a class needs an operator that falls into the bitwise-and abstraction and
an operator that falls into the concat abstraction.

> If so, then we haven't gained anything, and the only thing that would 
> satisfy such people would be for every function name and operator to be 
> unique -- something which is impossible in practice, even if it were 
> desirable.

I doubt that. I have never heard anyone ask for a different symbol
for integer and float addition. What I would prefer is a different
name and operator for each kind of abstraction.

-- 
Antoon



More information about the Python-list mailing list