Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How print() in python works on hardware level?

Good evening everyone! I’m interested in how the print() function works at the hardware level. That is, a detailed process of how some text is displayed on the screen, for example "Hello, World! I run Python code with print("Hello, World!") in it, what happens next?

I’ve already searched the internet for an answer to this question. I couldn’t find any text that explained this. I’ve seen answers about printf() from the C language, but I’m interested in the Python language. I’ve also seen answers about how it works with functions inside it, but I’m interested in how it works with regular text output.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It prints to stdout which is one of two steams handled by the operating system ( the other one stderr is for errors).

The python interpreter which is written in C is the layer responsible for handling this. You should look at how streams as implemented in C to know how it is handled in a hardware level.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading