#NEWLINE# def set_ring( self , new_ring ) : #NEWLINE# #INDENT# if ( new_ring . ring == new_ring ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . ring . symbols != new_ring . symbols ) : #NEWLINE# #INDENT# terms = list ( zip ( * _dict_reorder ( self , self . ring . symbols , new_ring . symbols ) ) ) #NEWLINE# return new_ring . from_terms ( terms ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return new_ring . from_dict ( self )