Fastest way to convert a byte of integer into a list

John Machin sjmachin at lexicon.net
Thu Jul 12 20:49:56 EDT 2007


On Jul 13, 10:28 am, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Godzilla <godzillais... at gmail.com> writes:
> > > num = 255
> > > numlist = [num >> i & 1 for i in range(8)]
>
> > Thanks matimus! I will look into it...
>
> numlist = lookup_table[num]
>
> where lookup_table is a precomputed list of lists.

Ummm ... didn't the OP say he had 32-bit numbers???




More information about the Python-list mailing list