On this page
numbers.Real
Prev: numbers.Rational | Up: numbers
Rel: numbers.Complex, numbers.Integral, numbers.Number, numbers.Rational
Ref: docs.python.org — numbers.Real
Tags: #public #python3 #stdlib #numbers
Import
import numbers
from numbers import Real
Signature & Overview
numbers.Real()
To Complex, Real adds the operations that work on real numbers.
Methods & Attributes
Real.conjugate(self)— Conjugate is a no-op for Reals.Real.imag(...)— Real numbers have no imaginary component.Real.real(...)— Real numbers are their real component.
Usage
import numbers
assert isinstance(3.14, numbers.Real) and isinstance(7, numbers.Real)
assert not isinstance(1 + 2j, numbers.Real)
Gotchas
Decimalis NOT anumbers.Real: Check(numbers.Real, Decimal)if accepting bothfloatandDecimal.
REPL Inspect
from numbers import Real
help(Real)
Linked from
Related notes
- tuts/python3/stdlib_module/numbers/Complex Linked here; links to this page; shared tags: #numbers, #stdlib
- tuts/python3/stdlib_module/numbers/Integral Linked here; links to this page; shared tags: #numbers, #stdlib
- tuts/python3/stdlib_module/numbers/Number Linked here; links to this page; shared tags: #numbers, #stdlib
- tuts/python3/stdlib_module/numbers/Rational Linked here; links to this page; shared tags: #numbers, #stdlib
- tuts/python3/stdlib_module/numbers Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib