On Sep 26, 8:20 am, Grant Edwards <inva...@invalid.invalid> wrote: > On 2010-09-26, Paul Rubin <no.em...@nospam.invalid> wrote: > > > Steven D'Aprano <st...@remove-this-cybersource.com.au> writes: > >> There's nothing obscure or unintuitive about "spam"*3 = "spamspamspam", > > Why would it not be ["spam","spam","spam"] or even "ssspppaaammm"? > > Because > > 3 * "spam" == "spam" + "spam" + "spam" > > Just like > > 3 * 6 = 6 + 6 + 6 > > 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. 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. Carl Banks Carl Banks -- http://mail.python.org/mailman/listinfo/python-list