Python's numeric tower

Ian Kelly ian.g.kelly at gmail.com
Sun Jun 15 03:22:50 EDT 2014


On Sat, Jun 14, 2014 at 8:51 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Does anyone know any examples of values or types from the standard
> library or well-known third-party libraries which satisfies
> isinstance(a, numbers.Number) but not isinstance(a, numbers.Complex)?

>>> issubclass(decimal.Decimal, numbers.Number)
True
>>> issubclass(decimal.Decimal, numbers.Complex)
False



More information about the Python-list mailing list