number class that serves as the top of the numeric hierarchy complex class that represents the complex numbers numbers of this type have real and imag attributes this class inherits from number real class that represents the real numbers inherits from complex rational class that represents fractions numbers of this type have numerator and denominator attributes inherits from real integral class that represents the integers inherits from rational the classes in this module are not meant to be instantiated insteadthey can be used to perform various kinds of type checks on values for exampleif isinstance(xnumbers numberstatements is any kind of number if isinstance(xnumbers integralstatements is an integral value if one of these type checks returns trueit means that is compatible with all of the usual mathematical operations associated with that type and that conversion to one of the built-in types such as complex()float()or int(will work the abstract base classes can also be used as base class for user-defined classes that are meant to emulate numbers doing this is not only just good idea for type checkingbut it adds extra safety checks that make sure you implement all of the required methods for exampleclass foo(numbers real)pass foo(traceback (most recent call last)file ""line in typeerrorcan' instantiate abstract class foo with abstract methods _abs_ __ _add_ __ _div_ __ _eq_ __ _float_ __ _floordiv_ __ _le_ __ _lt_ __ _mod_ __ _mul_ __ _neg_ __ _pos_ __ _pow_ __ _radd_ __ _rdiv_ __ _rfloordiv_ __ _rmod_ __ _rmul_ __ _rpow_ __ _rtruediv_ __ _truediv_ __ _trunc_ notes refer to ("classes and object-oriented programming"for more information on abstract base classes pep (about the type hierarchy and intended use of this module lib fl ff