using struct for the stuff you're up to and you'll finish with weird unmaintainable code. save yourself a lot of pain and use construct instead. http://pyconstruct.wikispaces.com/