Skip to content

Tag: c++

How can I parse an object in a python c-extention?

I have in Python an object such as: And I want to read it in c in the How can I access the members inside a pyObject for custom python data structures? How can I do the opposite thing, assign values to an object that will later be called inside python? edit: As suggested by kpie, using the function PyObject_G…

How to set python function as callback for c++ using pybind11?

It is from SDK which I can call the client from dynamic library in c++ codes. I want to port it to python bindings use pybind11. How do I set_callback in python? I have seen the doc and try: The code just failed to compile. My question, how do I convert the py::function to ftype_callback or there is other way

Inter process communication from python to cpp program

Suppose there are 3 files: f1.cpp, f2.py, f3.cpp. I am running the command on linux terminal as follows: The output of f1 goes perfectly into the input of f2. Also, f2’s output goes perfectly into f3. I am displaying the output in f3. f1 generates input for f2 after a particular interval. In this interv…

sqrt() c++ and math.sqrt() python

i am new at python and i had this precision problem with python which i did not have before with c++, the code is for python the result is for c++ the result is this can make crashes Answer Different programming languages may behave differently when it comes to float arithmetics. It may come to optimisations,…