| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
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.
Sorry, something went wrong.
|
although I'm not a fan of using /, I think it will be easier to make the only positional arguments in pure-Python implementation and I think here we will need ping more core members |
Sorry, something went wrong.
|
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, something went wrong.
Sorry, but I don't understand what you mean by "rest of the decimal sphinx docs". Do you mean some new functions like from_number? |
Sorry, something went wrong.
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. |
Sorry, something went wrong.
|
I also thought that there is a lot of / before arguments, but documenting it doesn't seem useful unless I'm missing something For example, fma method has next signature: fma(self, /, other, third, context=None) |
Sorry, something went wrong.
|
Sphinx docs don't include self arguments, so we omit leading /. |
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, I think all is fixed.
There is an odd description of the round() builtin, but it probably should be fixed separately.
Sorry, something went wrong.
|
Thank you for review |
Sorry, something went wrong.
|
Thanks @donbarbos for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
Sorry, something went wrong.
…le (pythonGH-131990) (cherry picked from commit 043f251) Co-authored-by: Semyon Moroz <donbarbos@proton.me>
|
Sorry, @donbarbos and @AA-Turner, I could not cleanly backport this to 3.13 due to a conflict. cherry_picker 043f251154fbac9a4e66243b8cae220a284ed1c4 3.13 |
Sorry, something went wrong.
|
GH-137902 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
|
GH-137904 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
…`` module (pythonGH-131990) (cherry picked from commit 043f251) Co-authored-by: Semyon Moroz <donbarbos@proton.me>
| Back | FazBrowse Home | New Git URL |
also noticed a missing default value num='0' for create_decimal
📚 Documentation preview 📚: https://cpython-previews--131990.org.readthedocs.build/en/131990/library/decimal.html#decimal-objects