How can I get rid of lambda

Steve Williams sandj.williams at gte.net
Mon Oct 16 07:04:26 EDT 2000


Robert Roy wrote:

> I went a step further with your code and created a lookup dict for all
> 256 char values. 100,000 reps went from 9.2 seconds to 3.9 seconds.
>
> Append the following to the code you posted
> #--------------
> # create a dict of characters and expansions
> l = {}
> for x in range(256):
>     l[chr(x)] = unpack(chr(x))
> #print l
> #print map(None, packedNumber)
>

[snip]

Very nice.  I'm surprised the dictionary lookup is so fast.

Thanks for your response.






More information about the Python-list mailing list