Re: translating ascii to binary

2008-09-25 Thread Lie
On Sep 17, 11:34 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Lie wrote: > >> Any advice about this matter would be very appreciated. > >> Thanks in advance. > > > It'd be easier to make a one-char version of ascii2bin then make the > > string version based on the one-char version. > > And it'd b

Re: translating ascii to binary

2008-09-17 Thread Tino Wildenhain
hi, Canned wrote: Steven D'Aprano schreef: Your "ascii_to_bin" method tries to do too much in one method. You should split the functionality into small, self-contained pieces, then combine them. And frankly, once you got to the part where you started popping and inserting, my brain melted. Yo

Re: translating ascii to binary

2008-09-17 Thread Canned
Steven D'Aprano schreef: > Your "ascii_to_bin" method tries to do too much in one method. You should > split the functionality into small, self-contained pieces, then combine > them. And frankly, once you got to the part where you started popping and > inserting, my brain melted. You are making

Re: translating ascii to binary

2008-09-17 Thread Steven D'Aprano
On Wed, 17 Sep 2008 18:02:15 +0200, Canned wrote: > Hi, > I'm trying to write a class that can convert ascii to binary and vice > versa. I write my class based on this function I've found on internet [...] > That works perfectly, but when I try to implement it in my own class it > gives me alot

Re: translating ascii to binary

2008-09-17 Thread Fredrik Lundh
Lie wrote: Any advice about this matter would be very appreciated. Thanks in advance. It'd be easier to make a one-char version of ascii2bin then make the string version based on the one-char version. And it'd be a lot easier to read your posts if you trimmed away at least some of the origi

Re: translating ascii to binary

2008-09-17 Thread Lie
On Sep 17, 11:02 pm, Canned <[EMAIL PROTECTED]> wrote: > Hi, > I'm trying to write a class that can convert ascii to binary and vice > versa. I write my class based on this function I've found on internet > > > > > > > def ascii_to_bin(char): > > ascii = ord(char) > > bin = [] > > > while (ascii >