PyDocs

Nav

Numeric and Mathematical Modules

Decimal.from_number

decimal

classmethod of Decimal · Added in 3.14
  • Decimal.from_number(number, /)
Alternative constructor that only accepts instances of float, int or Decimal, but not strings or tuples.
1 Example
>>> Decimal.from_number(314)
Decimal('314')
>>> Decimal.from_number(0.1)
Decimal('0.1000000000000000055511151231257827021181583404541015625')
>>> Decimal.from_number(Decimal('3.14'))
Decimal('3.14')
from the Python docs
See Also
No see-alsos for decimal/Decimal.from_number
0 Notes
No notes for Decimal.from_number