(self, *bits)
return self.__class__(*tuple(newargs))
Flip the bit(s) given.
Flip the bit(s) given.
Flip the bit ( s ) given .
def flip(self, *bits):
        """Flip the bit(s) given."""
        newargs = list(self.qubit_values)
        for i in bits:
            bit = int(self.dimension - i - 1)
            if newargs[bit] == 1:
                newargs[bit] = 0
            else:
                newargs[bit] = 1
        return self.__class__(*tuple(newargs))
def flip ( self , * bits ) : newargs = list ( self . qubit_values ) for i in bits : bit = int ( self . dimension - i - 1 ) if newargs [ bit ] == 1 : newargs [ bit ] = 0 else : newargs [ bit ] = 1 return self . __class__ ( * tuple ( newargs ) )