How to Read Bytes from a file

Leif K-Brooks eurleif at ecritters.biz
Thu Mar 1 06:42:22 EST 2007


Alex Martelli wrote:
> You should probaby prepare before the loop a mapping from char to number
> of 1 bits in that char:
> 
> m = {}
> for c in range(256):
>   m[c] = countones(c)

Wouldn't a list be more efficient?

m = [countones(c) for c in xrange(256)]



More information about the Python-list mailing list