(self, args)
Swap two variables.
Swap two variables.
Swap two variables .
def swap_(self, args):
        """Swap two variables."""
        name1, index1 = next(args)
        name2, index2 = next(args)
        name1, name2 = self.complete_name(name1), self.complete_name(name2)
        if name1[-1] != name2[-1]:
            # type mismatch
            raise error.BASICError(error.TYPE_MISMATCH)
        list(args)
        # get buffers (numeric representation or string pointer)
        left = self._view_buffer(name1, index1, False)
        right = self._view_buffer(name2, index2, True)
        # swap the contents
        left[:], right[:] = right.tobytes(), left.tobytes()
def swap_ ( self , args ) : name1 , index1 = next ( args ) name2 , index2 = next ( args ) name1 , name2 = self . complete_name ( name1 ) , self . complete_name ( name2 ) if name1 [ - 1 ] != name2 [ - 1 ] : # type mismatch raise error . BASICError ( error . TYPE_MISMATCH ) list ( args ) # get buffers (numeric representation or string pointer) left = self . _view_buffer ( name1 , index1 , False ) right = self . _view_buffer ( name2 , index2 , True ) # swap the contents left [ : ] , right [ : ] = right . tobytes ( ) , left . tobytes ( )