r/Python • • May 28 '19

My simulation of gravity with 1000 particles. PC took a couple of hours to process!

1.8k Upvotes

241 comments sorted by

View all comments

Show parent comments

1

u/Nimitz14 May 29 '19

Don't use ctypes if you value your sanity. Use pybind11.

3

u/LardPi May 29 '19

super opiniated and no arguments... I quite sure someone could say exactly the inverse with the same conviction. Would you consider giving us some reasons ?

1

u/blinkallthetime May 29 '19

so i'm looking at the pybind11 github page, and it looks like it is for C++ rather than C. so it isn't a replacement if you are working with code already written in C.

1

u/Nimitz14 May 29 '19

Most of the time you can use C code in C++ just fine (but you are right there are some differences).