This post is an introduction to the programming language Python.
FAQs about Python
What is Python?
Python is a high-level, object-oriented, dynamically typed and interpreted programming language.
Its first version was released on 1991, but it has received major updates over the time. The latest version update was Python3 on 2008.
Python is owned by the Python Software Foundation (PSF).
It has a BSD-based license, meaning that it is free and open source, what attracts some developers and explain its popularity among some communities like Linux users.
You need to have a Python virtual machine installed in your computer in order to run a Python application. The Python interpreter is called CPython.
One main characteristic that makes Python different to others is that it is dynamically typed. Because you do not need to worry about the variable types, it is easier and it is common among beginners and casual programs.
Python is sometimes referred as a glue language, because it is often used to connect large software components.
There are multiple libraries available for Python.
One critique about Python is that it is not as mature as other established programming languages.
Do I need to compile Python source code?
Source code files include the logic of the application in a format that is readable by a human. These files have .py extension file.
The interpreter CPython is not able read source code directly, and it needs it to be converted to bytecode, in the same way as other interpreted languages as Java.
Once a .py file is compiled, a new file .pyc with complied bytecode is generated.
Are there different versions of Python?
There has been different versions of Python.
Python 3 is the latest version and it is not backwards compatible. It was released on 2008.
Python 2 support ended on January 2020.
When you read about Python, most probably they are talking about Python 3.
Which Integrated Development Environment (IDE) is available for Python?
It is not mandatory to use an IDE to develop Python as there is a command-based tool. However, it may be more productive for most users to use a proper Integrated Development Environment (IDE).
Official Python IDE is Python IDLE.
PyCharm is a dedicated Python IDE developed by Czech company JetBrains that offers extended functionalities than Python IDLE. There are two version: an open source Community edition, and a paid Professional edition.
Visual Studio Code is a general IDE developed by American company Microsoft.
There are Eclipse extensions for Python, as for example, PyDev. Check these posts about how to install and configure Python on Eclipse on Windows and Ubuntu.
What are Python modules?
Python modules allow to add to your computer libraries, functionalities and tools already done, tested and provided by others. This enables reusability of code, and avoid having to develop your own tools and functionalities when someone else (or yourself previously) have already developed them and made them available.
Python modules can be imported to our computer using Package Installer for Python (PIP). Its command-line executable is ‘pip’.
You can install Python on a apt-compatible OS by typing in a terminal:
sudo apt install python3-pip
Can Python be used to develop graphical user interfaces (GUI)?
There are different Python modules available that provide graphical user interfaces:
- Free
- tkinter (standard GUI)
- wxPython (simpler but not simplest)
- PySimpleGUI (simplest)
- Kivy (for touch screens)
- Libavg (for touch screens)
- Commercial
- PyQt5
- PySide 2
Can Python be used to develop computer games?
There are some Python modules dedicated to games development:
- PyGame / PyGame Zero
- Pyglet
- Arcade
For example, video game “Frets on fire” is developed using PyGame.
You can find more information about Pygame on this post.
Can Python be used to use artificial intelligence (AI) and machine-learning (ML)?
There are specific modules to develop AI and ML apps. In fact, Python is a reference for people interested in working on those topics.
Does the user need to have Python installed on their computer to run an app? Is not that a drawback?
Python scripts need a Python interpreter (CPython) to run the compiled bytecode. Nevertheless, there are ways to create standalone files from the Python script (binaries) that can be run on specific OS without the need of an interpreter. So the short answer is ‘no’, it is not mandatory to have Python installed on your computer to run one of its programs.
One of the advantages of interpreted language is that the same file can be run on any computer without modifications. A drawback is that you need to have installed a Python interpreter (CPython) on each computer where it is going to run.
Alternatively, you can create an standalone executable file that does not require to have CPython previously installed, but on the other hand it will work only in specific platforms and the file will lose its portability.
How do I create a standalone file for a specific OS?
There are different Python modules to create an executable file:
- PyInstaller. Allows to create a Python standalone app for Windows, macOS and Linux. PyInstaller is available from PIP. You may need to install Microsoft Visual C++ Redistributable on Windows because of the use of shared libraries by the application. You can find more info about on this link.
- py2app. Creates apps for macOS.
- py2exe. Creates apps for Windows OS.
How do I start learning Python?
The official Python tutorial can be found on this link.
Other interesting online tutorials:
- LearnPython.org
- Python tutorial by W3School
There are many other webs and books to teach you how to learn Python. Just search for it using your favourite search engine.
How can I look up the Python built-in modules?
You may have a look at the Python 3 official documentation in the search for built-in modules:
https://docs.python.org/3/library/
You may find list all functions within a module by typing from Python interpreter:
dir(module)
You can also check information about a function within the module by typing on Python interpreter:
help(module.function)
How do I get help about Python?
Groups to get help about Python.
Reddit group r/learnpython
LinkedIn group “Python Developers Community”
You might be also interested in…
- How to configure Eclipse for Python on Windows 10
- How to configure Eclipse for Python on Ubuntu
- Programming languages
External references
- Data to fish; “Create Executable of Python Script using PyInstaller“; Data to fish
[…] Introduction to Python […]
[…] To read an introduction to Python language, you can have a look at this post. […]
[…] Introduction to Python […]