Skip to content

Documentation of "decimal" library #102431

@roman-huk

Description

@roman-huk

Documentation of "decimal" library - Context.logical_??? methods

There is a understatement in docstring of decimal.Context.logical_xxx methods. All arguments should be instances of decimal.Decimal, but consisting only of binary digits only (i.e. "0" and "1"). If the number is not an integer or consists of digits other than 0 and 1, an exception is thrown:

>>> import decimal
>>> ctx = decimal.getcontext()
>>> ctx.logical_or(decimal.Decimal(15), decimal.Decimal(22))
Traceback (most recent call last):
  File "<pyshell#71>", line 1, in <module>
    ctx.logical_or(Decimal(15), Decimal(22))
decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]

I think it would be good to describe this behavior explicitly.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions