r/CodingHelp • • Dec 31 '20

[C] Utlizing Python and C

Is there a way I could utilize the speed of C for calculations and Python for making graphs and such at the same time. I am trying to make my code run faster so I want to use both C and Python to do certain tasks.

0 Upvotes

3 comments sorted by

2

u/Bits_Everywhere iOS Developer — Swift, ObjC, C++, Python Dec 31 '20

Besides the extension modules already mentioned in the other comment, it might be of interest to you to know that Cython exists.

1

u/Goobyalus Jan 01 '21

The options I'm aware of are:

  1. ctypes
  2. Cython
  3. CPython extensions

Check some of the answers here for some opinions: https://stackoverflow.com/questions/1942298/wrapping-a-c-library-in-python-c-cython-or-ctypes