We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently gmpy2's arithmetic operators support python numbers:
>>> from gmpy2 import mpz >>> mpz(1) + 1 mpz(2)
But does not support objects with custom __mpz__, __mpq__, __mpfr__ or __mpc__ methods :
__mpz__
__mpq__
__mpfr__
__mpc__
>>> class A: ... def __mpz__(self): ... return mpz(1) ... >>> a=A() >>> mpz(1) + a Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for +: 'mpz' and 'instance'
This issue has been first seen in sage's ticket 23052.
I am currently working on a proposal for this issue.
The text was updated successfully, but these errors were encountered:
Merge pull request #217 from vinklein/arith_operator_custom_numbers
e7a281b
Fix issue #214 Allow arithmetic operation between gmpy2 numbers and custom objects
No branches or pull requests
Currently gmpy2's arithmetic operators support python numbers:
But does not support objects with custom
__mpz__
,__mpq__
,__mpfr__
or__mpc__
methods :This issue has been first seen in sage's ticket 23052.
I am currently working on a proposal for this issue.
The text was updated successfully, but these errors were encountered: