PyDocs

Nav

Numeric and Mathematical Modules

setcontext

decimal

function
  • setcontext(c, /)
Set a new default context.
1 Example
>>> setcontext(ExtendedContext)
>>> Decimal(1) / Decimal(0)
Decimal('Infinity')
>>> getcontext().traps[DivisionByZero] = 1
>>> Decimal(1) / Decimal(0)
Traceback (most recent call last):
  File "<pyshell#112>", line 1, in -toplevel-
    Decimal(1) / Decimal(0)
DivisionByZero: x / 0
from the Python docs
See Also
No see-alsos for decimal/setcontext
0 Notes
No notes for setcontext