I am writing a huffman implementation in Python as a learning exercise. I have got to the point of writing out my variable length huffman codes to a buffer (or file). Only
Correct. Most of the modules in the stdlib that need bitstreaming are written in C, with the details hidden away.