Three dumb questions (ordered by dumbness descending)
Duncan Booth
duncan at NOSPAMrcp.co.uk
Tue Sep 24 05:07:31 EDT 2002
Thorsten Kampe <thorsten at thorstenkampe.de> wrote in news:amnvit$7kqdt$1 at ID-
77524.news.dfncis.de:
> 1. Why is 'zip(zip(x)) != x' (should be the same because it's the
> transposed)
Because zip(x) doesn't transpose x. BUT, zip(*x) does transpose x.
So the question is what zip(*zip(*x)) does?
>>> x = [(1, 2), (3, 4), (5, 6)]
>>> x == zip(*zip(*x))
1
Provided x is a list of tuples, and you expand the list into separate
arguments when calling zip, it is indeed its own inverse.
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list