Prev: - | Next: What to install
... a high-level general-purpose programming language
- high-level: Python is a more abstract language compared to C. This adds expressiveness to Python and offers power to programmers to write more flexible and efficient code. The downsize might be that Python code is slower in occasions, but many optimization methods exist to deal with this issue.
- general-purpose: Python is not bound to any specific programming purpose (unlike R which is specifically 'statistics-oriented') nor programming paradigm (unlike Java which imposes object-oriented programming techniques). This feature makes Python a powerful tool for a variety of applications in various scientific domains and also in education. The interested developer will find numerous domain-specific packages to start writing specialized code for the domain of interest. The teacher has a versatile tool to advance students' computational thinking.
Read Python docs: "What is Python? Executive Summary"
- a) simplicity: Python expression is laconic. Much of Python simplicity comes from the fact that the language is dynamically typed and does not require variable declaration. Also important is that there is no need for brackets of any kind for starting/closing blocks of code, just simply code indentation.
- Simplicity of code helps to:
- (a) ...focus on what is important; thus, promote the expression and development of learners' 'computational thinking' without being baffled by syntactic nuances
- (b) ...increase productivity; writing simple code saves time and money.-
Take a look at the 'Hello World' code in Python compared to two other popular languages.
#### in C
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
#### in Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
#### in Python 3
print('Hello World!')
- b) readability: simplicity promotes also readability and this is important in development as "a piece of code is written once but is read many times"
- Many Python coding conventions that enhance readability are described in PEP 8 "Style Guide for Python Code" (PEP = "Python Enhancement Proposals")
# Simplicity and Readability in Python code
garden = ['rose', 'carnation', 'gardenia']
for flower in garden:
print(flower)
# You are most likely to understand this code lines without any further explanation!
κήπος = ['τριαντάφυλλο', 'γαρύφαλλο', 'γαρδένια']
for λουλούδι in κήπος:
print(λουλούδι)
- 2.x appeared in 2000. It survives until today because of the numerous packages developed and is still used in many domains.
- 3.x appeared in 2008: it represents the present and future of the language. Start learning the 3.0 version without worrying too much about 2.x (transposing code between the two versions is easy).
import this
. Free learning material
. See full copyright and disclaimer notice