#NEWLINE# def lcm( self , other ) : #NEWLINE# #INDENT# 'Least common multiple of monomials. ' #NEWLINE# if isinstance ( self , Monomial ) : #NEWLINE# #INDENT# exponents = other . exponents #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( other , ( tuple , Tuple ) ) : #NEWLINE# #INDENT# exponents = other #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise TypeError ( ( 'an instance of Monomial class expected, got %s' % other ) ) #NEWLINE# #UNINDENT# #UNINDENT# return self . rebuild ( monomial_lcm ( self . exponents , exponents ) )