[Chicago] next meeting

Ian Bicking ianb at colorstudy.com
Tue Feb 27 18:20:40 CET 2007


sheila miguez wrote:
> On 2/27/07, Atul Varma <varmaa at gmail.com> wrote:
>> At dinner on Saturday, Fei-han (I believe that was his name--not sure if I'm
>> spelling it right) mentioned that he would be interested in giving a
>> presentation on unicode in Python.  In it he would explain Unicode as though
>> he were talking to a child, where Chris is the child.
> 
> That's a good idea--and I'd like to see someone go through bit-banging
> when taking strings of "hex digits" and doing calculations on them
> and/or passing them through a serial port over to a hardware test
> fixture as though they were actually hex digits, because I had to do
> that in other languages and it seemed to work okay even though I was
> duck typing from a string to, I guess, array bytes? We were worried
> that when we upgraded to this unspeakable language's version where it
> switched to unicode representations of strings that it would screw
> things up but it didn't. yay.

Would that be like:

def hex2bytes(input, output):
     for i in range(0, len(input), 2):
         output.write(chr(int(input[i:i+2], 16)))

Well, that's like current Python.  In Python 3k I believe you would 
simply do output.write(int(input[i:i+2], 16)), since byte streams just 
contain integers.


-- 
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org


More information about the Chicago mailing list