Re: Python Mystery Theatre -- Episode 2: Así Fue
creedy at mitretek.org
Tue Jul 15 17:14:12 CEST 2003
> In article <3F140F34.1030401 at mitretek.org>,
> Chris Reedy <creedy at mitretek.org> wrote:
>>Aside: I have to admit that the ((42,) * 2) did confuse me at first. I'm
>>so used to doing 2 * (42,) when I want to repeat a sequence that I
>>hadn't thought about the reversed form.
> My experience is that most people do it the way Ray did, <seq> * <reps>.
This must be my math background confusing me. Conventionally, a+a is
written as 2a, and a*a is written as a^2 (or a**2). Of course, if you
recognize that concatenation of sequences is really a multiplication (by
convention in mathematics addition is always a commutative operator),
a*2 makes sense. I guess I'll change the way I write this in the future.
More information about the Python-list