D
D
Dmitry2013-06-22 12:23:59
Python
Dmitry, 2013-06-22 12:23:59

Please explain when you need to write a python module in pure C, instead of using ctypes?

The question is related to a misunderstanding when, instead of using ctypes, you need to sit down and write in pure C?

PS:
The reason for the performance of the product is not taken into account, it is so obvious. What other reason is there besides it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2013-06-22
@EvilsInterrupt

Yes, it was about ctypes that the question asked.
I am well aware of the availability of functions on Py_*.
I'll try in other words. When we need to use something that is not available in python. For example, a large library code written in C ++ by the company where we work, we can do this in two ways:
1) Write a pure module using the C programming language
2) Write a dll, where the functions will be either cdecl or stdcall, and then write a Python module using the ctypes module
As a rule, the second option wins in terms of code readability, while not losing much in performance over the first. Let's say I have not seen a case where the code written according to the first option would be better than written according to the second.
So the question arises: Give an example of a situation where the second method is either not possible or too difficult and therefore the first one must be used.
I hope the question is clearer now.
PS:
There is no reason to minus! If you don't understand a question, ask for clarification. Otherwise, such behavior puts you on the level of a jerk. We all may not know something and this is quite natural, for this there is an opportunity to communicate with other specialists.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question