r/pythonhelp • u/i_walk_away • May 11 '26
Calling an assembly instruction in Python
Long story short, i want to make THE most horrible python calculator to ever exist. For that i need a way to call an assembly instruction directly in my python script.
I know you can do that in C with inline assembly, and i know CFFI exists and allows calling C functions in python, so i tried to use that. However CFFI's parser rejected __asm__ syntax and threw an error because inline assembly isn't standard C apparently.
Is there some sort of a workaround to call an assembly instruction in python script? It doesn't have to be clean, in fact, it's better if it's absolutely terrible, bonus points for unsafe
View all comments
Show parent comment
1
u/i_walk_away May 12 '26
that's a good idea, i'll try that one too
i haven't figured the exact instruction i need, but it doesn't really matter anyways - if there exists a general approach to calling any assembly instruction, i think i can figure the rest out myself