Making a dict from two lists/tuples
Duncan Booth
duncan at NOSPAMrcp.co.uk
Thu May 24 09:12:34 EDT 2001
"Alex Martelli" <aleaxit at yahoo.com> wrote in
news:9eip7i0s67 at enews1.newsguy.com:
> The fancy/neat form seems to be better than
> three times faster on my box, so it may be
> worth using DESPITE its fanciness...:-).
If you bump up the ranges to 100000 the difference increases to a factor of
eight or better.
Definitely worth using, provided you have first profiled the code and know
that it is a bottleneck.
--
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