R
R
Russian Federation2015-11-29 17:17:54
Python
Russian Federation, 2015-11-29 17:17:54

CtypesPython. How to use arithmetic operations?

For example, here is the code:

from ctypes import c_longlong as ll
k = ll(10**17-1)
k-=1
This code doesn't work
from ctypes import c_longlong as ll
k = ll(10**17-1)
k-=ll(1)

And so too.
How to implement arithmetic in "sish" types?
How to provide a class with an __add__ method? Or are there other ways?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Tsilyurik, 2015-11-29
@Olej

Python
12/18/2013
The subtleties of using the Python language: Part 6. Ways of integrating Python and C / C ++ applications
12/18/2013:
The subtleties of using the Python language: Part 7. Features of interaction with C ++. distutils package, Boost.Python library, Cython project
12/20/2013:
The subtleties of using the Python language: Part 8. Features of interaction with C ++. SWIG project and reverse integration of Python into C/C++ applications

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question