sequence multiplied by -1
steve at REMOVE-THIS-cybersource.com.au
Sat Oct 2 06:38:16 CEST 2010
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?
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
And if not, then ask yourself, why is it acceptable for bitwise-and and
concatenation to share the same operator, but not for addition and
concatenation? Is it just because addition is more common than bitwise-
> As for repeat, I can't personally think of a time I ever repeated
> anything but a single item, and that only rarely. It's not useful
> enough to deserve its own syntax, and the language wouldn't have
> suffered one bit if it had been a method of sequences.
I disagree. I think that the ability to write:
line = "-"*50
pays for everything. But I accept that this is a matter of opinion, and
others may disagree. When you create your own language, feel free to do
something different :)
More information about the Python-list