"Gabriel Genellina" <[EMAIL PROTECTED]> writes: > En Fri, 02 Mar 2007 08:22:36 -0300, Bart Ogryczak > <[EMAIL PROTECTED]> escribió: > >> On Mar 1, 7:36 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> >> wrote: >>> Thanks Bart. That's perfect. The other suggestion was to precompute >>> count1 for all possible bytes, I guess that's 0-256, right? >> >> 0-255 actually. It'd be worth it, if accessing dictionary with >> precomputed values would be significantly faster then calculating the >> lambda, which I doubt. I suspect it actually might be slower. > > Dictionary access is highly optimized in Python. In fact, using a > precomputed dictionary is about 12 times faster:
Why using a dictionary and not a list? Matthias -- http://mail.python.org/mailman/listinfo/python-list