At programming level it seems correct (a part a "return" closure needed for the "main" function).
But the error is IMHO conceptual: for a char you need 7 bits (from 0 to 127 or in hex from x00 to x7F) and you can't accomodate the other char in only one bit! The other 128 symbols (from 128 to 255 or in hex from x80 to xFF) are only possible because you use again 7 bits, but with the 8th bit set to 1! What you are trying to do I made in C language (some years ago...) using however bytes and words, packing 2 bytes in only one word, but you can't pack 2 chars (each one beeing nearly a byte) in a byte! -- http://mail.python.org/mailman/listinfo/python-list