-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
gh-131885: update function signatures with /
in decimal module
#131990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
/
for decimal.Context
methods docs/
for decimal.Context
methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that signatures for pure-Python versions differ wrt C-coded extension:
>>> import _decimal, _pydecimal
>>> help(_decimal.getcontext().plus)
Help on built-in function plus:
plus(x, /) method of decimal.Context instance
Plus corresponds to the unary prefix plus operator in Python, but applies
the context to the result.
>>> help(_pydecimal.getcontext().plus)
Help on method plus:
plus(a) method of decimal.Context instance
Plus corresponds to unary prefix plus in Python.
The operation is evaluated using the same rules as add; the
operation plus(a) is calculated as add('0', a) where the '0'
has the same exponent as the operand.
>>> ExtendedContext.plus(Decimal('1.3'))
Decimal('1.3')
>>> ExtendedContext.plus(Decimal('-1.3'))
Decimal('-1.3')
>>> ExtendedContext.plus(-1)
Decimal('-1')
If we are going to add slashes - pure-Python version should be fixed. Or vice-versa.
although I'm not a fan of using and I think here we will need ping more core members |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry for a delay, it's look ok for me. Would you like to fix the rest of the decimal sphinx docs in another pr? |
Sorry, but I don't understand what you mean by "rest of the decimal sphinx docs". Do you mean some new functions like |
For example, setcontext() function: >>> import _decimal, _pydecimal, inspect
>>> inspect.signature(_decimal.setcontext)
<Signature (context, /)>
>>> inspect.signature(_pydecimal.setcontext)
<Signature (context)> You should also check Decimal methods. |
/
for decimal.Context
methods/
in decimal module
I also thought that there is a lot of For example, |
Sphinx docs don't include self arguments, so we omit leading |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think all is fixed.
There is an odd description of the round() builtin, but it probably should be fixed separately.
Thank you for review |
also noticed a missing default value
num='0'
forcreate_decimal
*
and/
as needed #131885📚 Documentation preview 📚: https://cpython-previews--131990.org.readthedocs.build/en/131990/library/decimal.html#decimal-objects