def __init__(self, **attrs): super(_char_t,self).__init__(**attrs) # calculate the size of .length based on .encoding res = __builtin__.unicode('\x00', 'ascii').encode(self.encoding.name) self.length = len(res)