Writing an assembler in Python

dieter dieter at handshake.de
Wed Jun 20 01:16:33 EDT 2018


iansuderman at gmail.com writes:

> What does the code look like to insert assembler into python and how does that code send information back to python.

Python is a "high level" language: it tries hard to hide many
"low level" details such as addresses and memory management.
Thus, it is quite far away from low level assembler code.

You can use something like "cython" to compile something
similar to Python source code into C/C++ code - either
for direct optimizations or to interface with C/C++
libraries. In the second case, the C/C++ functions can include
assembly code (provided this is supported by the compiler).

"cython" handles most of the difficulties of Python's C API,
thus typically providing for (rather) safe Python-C/C++ interaction.
I suggest to read its documentation.




More information about the Python-list mailing list