How is python executed as its entered? Why do we have an interpreter and a compiler, can't we just have one common thing? | Sololearn: Learn to code for FREE!

+1

How is python executed as its entered? Why do we have an interpreter and a compiler, can't we just have one common thing?

4/30/2017 5:49:37 AM

Vivek Raj

6 Answers

New Answer

+13

use pycharm

+11

because it is developed by different mind set from different people in different background and different environment for different purpose. diversity is good think. with intepreter you debug your code directly, something that you can't do with compiler. both has advantage and disadvantage.

+9

Python has several ways of execution. You can either apply an interactive approach and have the code executed line by line as you press Enter or build a script and run it through the interpreter. It will also go line by line but will stop on errors or after it finishes the last line. A kind of a mid-way approach is a notebook (Jupyter for example), where you can dynamically choose on-the-go how you want your code to be executed. There are also scripting windows embedded sometimes in data analysis applications (Power BI, Visual Studio) - which enable you to run Python scripts inside the app and retrieve the data for further utilization.

+7

Python doesnt have "compiler", only "interpreter"... You're probably talking about the standalone interpreter and the command line interpreter ^^ Both are complementary, the second one allowing to quickly test some instructions, without having to saving a source file and executing it through the standalone interpreter :P

+1

I got another question, so interpreter is useful for debugging the code directly, but let's say we are using python for data analysis or something with a lot of computation the interpreter would say there is no problem with the code even though we can get logical errors while running the code with data, so how do we avoid this ?

+1

thanks Angus MEI, I'll check out pycharm!