What is Python doing?

Hi, this might be a stupid question but I was wondering what is Python doing when you just type a variable or object without enclosing it in print().Is python giving you a description of the object/string or is it giving you the" __str__method’s output (how the object should be printed out)?

56 AM

object is a reserved keyword in python, its the base for all classes, i do not recommend overwriting it.

There are two type of interfaces: GUI (graphical user interface) and CLI (command line interface), print() prints to the command line output.

the IDLE (software shipped with python) is a bit special. It is more verbose, it prints more. if you do:

>>> x = "hello world"
>>> x

the IDLE will print the value of x. (>>> indicates use of IDLE)

however, if you where to put that code in a script:

# hello_world.py
x = "hello world"

nothing will be printed, you need print(x)

each class has magic methods, included by default (inherited from object), you can recognize magic methods by the two underscores before and after the method name (__init__ is a magic method, so is __str__), you can read about it here: