When I first started learning Python through code academy, it all seemed very easy and fun to code using python. But this fun didn’t last for long until I started with an assignment related to data extraction and massaging of data. That’s when I felt, what I know about python is way too less and understood the need to dive deeper into the concepts and advanced topics in python.
So, here I am with a blog about this amazing cross platform language, presenting some of the information that I found while researching and learning more about Python.
There were several questions that came to my mind when I first started to learn this language. Let’s unravel each and every question that I had, in this blog.
Firstly, Is Python a programming or scripting language?
While mostly called as a programming language, Python is, technically, a scripting language. It doesn’t use a compiler and can run on any device that runs the Python shell. It is not syntactically complex and difficult to learn, rather easily readable by a human thus making it easier to debug. These features of Python makes it less intimidating than other programming languages like C++, C.
Next, Is Python code compiled, Interpreted or both?
Compiled languages are executed directly on a computer's processor. A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer's processor uses.
An interpreted language is any programming language for which the conversion occurs at the same time as the program is being executed line by line.
A compiler (in the broadest sense) is a translator. It translates program A to program B and for future execution it using a machine M.
An interpreter (in the broadest sense) is an executor. It is a machine M that executes program A.
Now coming to Python:
A python code (myfile.py) when imported creates a file (myfile.pyc) in the same directory. Let us say the import is done in a python shell. After the import I change the code a bit and execute the imported functions again to find that it is still running the old code. This suggests that *.pyc files are compiled python files similar to executable created after compilation of a C file, though I can't execute *.pyc file directly.
When the python file (myfile.py) is executed directly ( ./myfile.py or python myfile.py ) no .pyc file is created and the code is executed as is indicating interpreted behavior.
The terms interpreted or compiled is not a property of the language but a property of the implementation. Python program runs directly from the source code . so, Python will fall under the bytecode interpreted category. The .py source code is first compiled to bytecode as .pyc. This byte code can be interpreted , or JIT compiled..
Is Python a cross platform language?
Ability of a programming language that enables programmers to develop software for several platforms by writing a program only once. Cross-platform software can run on most or all systems with little or no modification. Also called multi-platform languages.
It means that you can write a program that will work and support many platforms, such as Linux’s based OS, Windows, MacOS, etc.
Python program written on a Macintosh computer will run on a Linux system and vice versa. Python programs can run on a Windows computer, as long as the Windows machine has the Python interpreter installed (most other operating systems come with Python pre-installed).Thus Python itself is not cross-platform.
Yes, you can write a program in Python that will work on other operating systems, but Python, the language itself, makes no guarantees of being cross-platform. You can easily write a program that runs on Windows, but fails miserably on Linux.
In Python you can call true cross-platform programs, such as those written in Java.
A Python program can be cross-platform. It is not guaranteed to be.
Now, let’s talk about the code editors and IDE that is used to execute python programs, which I was totally unaware before starting my first assignment in python
So, What is an IDE and code editor?
Firstly, we need to understand that IDE and code editor are two different things.
Text/Code Editor: Code editors are the lightweight tool that allows you to write and edit the code with some features such as syntax highlighting and code formatting. It provides fewer features than IDE.
Integrated Development Environment (IDE): IDEs are GUIs( Graphical User Interface) where programmers write their code and produce the final products. It provides essential tools and other features such as debugging, execution, testing, and code formatting required for software development and testing, that helps programmers.
I started using Kaggle notebooks to start coding in python and later on I came to know that there are many IDEs and code editors that can be used.
Kaggle Notebooks are essentially Jupyter notebooks that can be used free of charge! The processing power for the notebook comes from servers in the cloud, not your local machine, so you can do a lot of data science and machine learning without burning through your laptop’s battery!
Let’s see the some of the top IDEs that can be used for python programming:
Visual studio code
There are so many IDEs and code editors available for python, but choosing the best code editor or IDE is always a challenge. Choosing the best code editor or IDE depends on so many factors such as project type, project size, OS support and considering a lot of other features.
Hope, I was able to cover some of the basic questions on python to the best of my knowledge.
Python… the most popular and favorite programming language in the world for programmers of all age groups. Over the last few years, Python has emerged as one of the most used languages by the programmers, thanks to its high versatility and developer community.
Python can be used for web development, back end development, software development, data science and writing system scripts and many more.
Versatile, Easy to Use and Fast to Develop.
Open Source with a Vibrant Community.
Has All the Libraries You Can Imagine.
Great for Prototypes - You Can Do More with Less Code.
Problems with Threading.
Not Native to Mobile Environment.
This language is an obvious choice for machine learning, data analysis and visualization. Just like any programming language, Python is not a perfect fit for all projects but, it can be a very good choice in many use cases.
Thanks for reading!