Re: Fastest way to convert a byte of integer into a list

2007-07-14 Thread jigloo
On 7 13 , 6 34 , Godzilla <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to find a way to convert an integer (8-bits long for > starters) and converting them to a list, e.g.: > > num = 255 > numList = [1,1,1,1,1,1,1,1] > > with the first element of the list being the least significant, so > t

Re: Fastest way to convert a byte of integer into a list

2007-07-14 Thread John Machin
On Jul 15, 11:12 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jul 14, 5:49?pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > > > On Jul 13, 3:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > On Jul 13, 5:17 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > > > On Jul 12, 5:3

Re: Fastest way to convert a byte of integer into a list

2007-07-14 Thread [EMAIL PROTECTED]
On Jul 14, 5:49?pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jul 13, 3:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > > > > On Jul 13, 5:17 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > > On Jul 12, 5:34 pm, Godzilla <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > > I'm t

Re: Fastest way to convert a byte of integer into a list

2007-07-14 Thread Paul McGuire
On Jul 13, 3:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jul 13, 5:17 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > > > > > On Jul 12, 5:34 pm, Godzilla <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I'm trying to find a way to convert an integer (8-bits long for > > > starter

Re: Fastest way to convert a byte of integer into a list

2007-07-13 Thread [EMAIL PROTECTED]
On Jul 13, 5:17 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jul 12, 5:34 pm, Godzilla <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I'm trying to find a way to convert an integer (8-bits long for > > starters) and converting them to a list, e.g.: > > > num = 255 > > numList = [1,1,1,1,1,1,1,1]

Re: Fastest way to convert a byte of integer into a list

2007-07-13 Thread Paul McGuire
On Jul 12, 5:34 pm, Godzilla <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to find a way to convert an integer (8-bits long for > starters) and converting them to a list, e.g.: > > num = 255 > numList = [1,1,1,1,1,1,1,1] > > with the first element of the list being the least significant, so >

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread Paul Rubin
Godzilla <[EMAIL PROTECTED]> writes: > Regarding to the 32-bit number, the lenght is variable but it is > usually defined at design time... That you're trying to represent it as a list of bits at all is weird, and probably likely to slow the program down. You do know that python has arbitrary siz

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread Godzilla
On Jul 13, 11:13 am, bsneddon <[EMAIL PROTECTED]> wrote: > On Jul 12, 8:49 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > On Jul 13, 10:28 am, Paul Rubin wrote: > > > > Godzilla <[EMAIL PROTECTED]> writes: > > > > > num = 255 > > > > > numlist = [num >> i & 1 for i in r

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread bsneddon
On Jul 12, 8:49 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 13, 10:28 am, Paul Rubin wrote: > > > Godzilla <[EMAIL PROTECTED]> writes: > > > > num = 255 > > > > numlist = [num >> i & 1 for i in range(8)] > > > > Thanks matimus! I will look into it... > > > numlist

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread Paul Rubin
John Machin <[EMAIL PROTECTED]> writes: > > numlist = lookup_table[num] > > where lookup_table is a precomputed list of lists. > Ummm ... didn't the OP say he had 32-bit numbers??? He asked about 8 bit numbers. I saw something about 32-bit numbers but figured those would be split into bytes or so

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread John Machin
On Jul 13, 10:28 am, Paul Rubin wrote: > Godzilla <[EMAIL PROTECTED]> 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 list

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread Alan Isaac
> On Jul 13, 9:54 am, Matimus <[EMAIL PROTECTED]> wrote: >>num = 255 >>numlist = [num >> i & 1 for i in range(8)] Godzilla wrote: > Thanks matimus! I will look into it... Watch out for the order, which might or might not match your intent. Cheers, Alan Isaac -- http://mail.python.org/mailma

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread Paul Rubin
Godzilla <[EMAIL PROTECTED]> 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. -- http://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread Godzilla
On Jul 13, 9:54 am, Matimus <[EMAIL PROTECTED]> wrote: > On Jul 12, 3:34 pm, Godzilla <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I'm trying to find a way to convert an integer (8-bits long for > > starters) and converting them to a list, e.g.: > > > num = 255 > > numList = [1,1,1,1,1,1,1,1] > >

Re: Fastest way to convert a byte of integer into a list

2007-07-12 Thread Matimus
On Jul 12, 3:34 pm, Godzilla <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to find a way to convert an integer (8-bits long for > starters) and converting them to a list, e.g.: > > num = 255 > numList = [1,1,1,1,1,1,1,1] > > with the first element of the list being the least significant, so >

Fastest way to convert a byte of integer into a list

2007-07-12 Thread Godzilla
Hello, I'm trying to find a way to convert an integer (8-bits long for starters) and converting them to a list, e.g.: num = 255 numList = [1,1,1,1,1,1,1,1] with the first element of the list being the least significant, so that i can keep appending to that list without having to worry about the