fork download
  1. import abc
  2. import copy
  3.  
  4. class Life(object):
  5. __metaclass__ = abc.ABCMeta
  6.  
  7. @abc.abstractmethod
  8. def reproduce(self):
  9. pass
  10.  
  11. class Bacterium(Life):
  12. def reproduce(self):
  13. return copy.deepcopy(self)
  14.  
  15. wiggly = Bacterium()
  16.  
  17. print 'The magic method mro is: {}'.format(wiggly.__class__.__mro__)
  18. print 'The abc method mro is: {}'.format(wiggly.__class__.mro())
Success #stdin #stdout 0.02s 8168KB
stdin
Standard input is empty
stdout
The magic method mro is: (<class '__main__.Bacterium'>, <class '__main__.Life'>, <type 'object'>)
The abc method mro is: [<class '__main__.Bacterium'>, <class '__main__.Life'>, <type 'object'>]