Python: Preamble
Mcvean Soans
Posted on November 25, 2020
This is the first post in the Becoming a Python Developer series! This series is intended towards everyone. Be it complete beginners or professional developers, the posts are sure to be helpful in grasping the concepts and a perfect launchpad for your Python journey! 😄
What is Python? Why is it gaining popularity?
In recent times, the need for a developer is a programming language that provides both C-style functional programming as well as Java-style object orientation. Whenever, functional aspects like calculations or processing is involved, C-style coding is preferred, while the need for classes and objects is completed by Java-style coding.
Python is an open-sourced programming language that combines the features of C and Java. It has exceptional procedural as well as object-oriented capabilities. Having said this, always remember that everything in Python is an object.
Some Features of Python
- Simple and Easy to learn - Learning Python is very simple compared to other programming languages.
- Dynamically Typed - In Python, we need not specifically declare the datatype of the variables used (unlike statically typed languages like C and Java).
- Platform Independent - When a Python program is compiled using a Python compiler, it generates byte code. Using a Python Virtual Machine (PVM), anyone can run the byte code instructions on any computer system.
- Procedure and Object Oriented - Python gives emphasis on the functions as well as objects.
- Scripting Language - A scripting language is a programming language that utilizes an Interpreter to translate the source code into machine code on the fly (while running). Other scripting languages include PHP, Bash, etc.
- Database Connectivity - Python provides Application Programming Interfaces (APIs) to connect its programs to all major databases like Oracle, MySql, SQLite Browser, etc.
- Batteries Included - Python contains several packages available for immediate use by developers. These packages make development easier due to the various features supported by them. Some of these packages include: numpy - for working with single and multi-dimensional arrays, pandas - for data analysis and data manipulation, matplotlib - for data visualization, etc.
Some differences between C and Python
C | Python |
---|---|
It is a procedure-oriented programming language, and does not contain features such as objects, classes, etc. | It contains features from procedure-oriented programming languages as well as object oriented programming languages. |
Program execution is faster. | Slower execution of programs as compared to C. The PyPy flavor of Python programs run a bit faster. |
It is a statically-typed language (variable declaration with appropriate datatype is compulsory). | It is a dynamically-typed language. Type declaration is not required. |
Memory allocation and deallocation requires user-intervention. | Memory allocation and deallocation is done automatically by the PVM. |
Indentation does not have any importance in C. | Indentation plays a major role and the code blocks need to be correctly indented. |
Some differences between Java and Python
Java | Python |
---|---|
Java is essentially an object-oriented programming language. | Python blends functional programming features with the object-oriented approach of programming. |
Java programs are verbose (contain many lines of code). | Python programs are concise and compact, and very few lines of code are required to achieve any specified task. |
It is compulsory to declare the datatypes of the variables, arrays, etc. (statically-typed language) | Type declaration is not required in Python (dynamically-typed language). |
Memory allocation and deallocation is done by JVM (Java Virtual Machine). | Memory allocation and deallocation is done by PVM (Python Virtual Machine). |
Indentation does not have any importance in Java. It is required only for better readability of the code. | Indentation plays a major role in Python, and improper indentation may lead to errors in the program. |
Posted on November 25, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.