zip() or what?

Ray Tomes rtomes at
Thu Jul 3 12:13:24 CEST 2003

Erik Max Francis wrote:
> Ray Tomes wrote:
>>request to flip array ...

> 	zip(*x)

>>Alternatively, is there a construct to get x[*][i] if you know what I

> 	[i[1] for i in x]

Thanks Erik, these do just what I want.
I can understand the 2nd one, but I don't get the meaning of the * in the 
first. Is this like the opposite of putting [] around something or what?
Under what circumstances can an * be used like this, and what is it 
called? - I don't know how to look for it in the docs :-)

also, ...

achrist at wrote:
 > Ray Tomes wrote:
 >>This I am trying to flip an array around so that the "subscripts" happen
 >>in the opposite order

 > 	[x[-i-1] for i in range(len(x))]

Thanks Al, but that was not the flip I was looking for sorry - I hadn't 
realised it could be taken another way. I wanted to swap the subscripts 
with each other (a 45 degree reflection) not within one subscript end to 
end (a 90 degree reflection). Erik has done the one I wanted.

More information about the Python-list mailing list