(self, in_int, unsigned=False)
return self
Set value to Python int.
Set value to Python int.
Set value to Python int .
def from_int(self, in_int, unsigned=False):
        """Set value to Python int."""
        if unsigned:
            # we can in fact assign negatives as 'unsigned'
            if in_int < 0:
                in_int += 0x10000
            intformat = '<H'
            maxint = 0xffff
        else:
            intformat = '<h'
            maxint = 0x7fff
        if not (-0x8000 <= in_int <= maxint):
            raise error.BASICError(error.OVERFLOW)
        struct.pack_into(intformat, self._buffer, 0, in_int)
        return self
def from_int ( self , in_int , unsigned = False ) : if unsigned : # we can in fact assign negatives as 'unsigned' if in_int < 0 : in_int += 0x10000 intformat = '<H' maxint = 0xffff else : intformat = '<h' maxint = 0x7fff if not ( - 0x8000 <= in_int <= maxint ) : raise error . BASICError ( error . OVERFLOW ) struct . pack_into ( intformat , self . _buffer , 0 , in_int ) return self