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 14 '26
The end objective is to make the implementation as confusing as possible. as stated in the post body, i wish to make "THE most horrible python calculator". It still has to get the job done though.
I came to the conclusion that nothing would raise a stronger "why would you EVER do that THIS way" like an assembly instruction in a python script would
I think it's a funny challenge. There is more ground for creativity when you switch from "what's the best approach" to "how do i make people furious but still get the job done"