r/learnpython • • Jan 05 '24

Why are interpreters required for programming ?

i'm trying to learn python ....i'm hearing a lot of stuff about interpreters....just wanna know what are they for..why are they required...can i learn python without interpreter...without vs code or py charm

Cuz i wrote some codes in python and it worked without connecting python to interpreter ....why is an interpreter necessary

Plz enlighten me

14 Upvotes

71 comments sorted by

View all comments

2

u/[deleted] Jan 05 '24

Compiler takes source code and translates it into object file and with linker finally into the executable binary ready for executing on desired architecture only once. Interpreter takes source code and doesn't build exe file, but directly translates and executes every time you start it. Fun fact, every language can be either compiled or interpreted.

1

u/sausix Jan 06 '24

Interpreter C and C++? It breaks when macros and templates are involved.

Interpreting probably only works if code is executed top to bottom. Excluding those languages that allow late definitions.