1 from abc import ABCMeta, abstractmethod 2 3 4 -class Group(object): 5 __metaclass__ = ABCMeta 6 7 @abstractmethod 8 - def multiply(self, g, h): 9 ''' Implements the group operation. ''' 10 pass 11 12 @abstractmethod 13 - def inverse(self, g): 14 ''' Implements the group inversion. ''' 15 pass 16 17 @abstractmethod 18 - def unity(self): 19 ''' Returns the group unity. ''' 20 pass 21 22 - def identity(self): 23 return self.unity() 24