Diving Into Python - Chapter 2

Getting a Theme


For getting the theme of Python, kindly go through my previous article,

Introduction


In this second part we will learn about Python and several other programming languages. We will compare several programming languages with Python using some basis concepts and examples.
So let's explore them, one by one.

Python VS Java

  • As we know, time complexity is directly proportional to space. On behalf of this we can compare both Python and Java. A Python snippet runs much slower compared to Java snippets.
  • Python snippets take very less memory compared to Java. That's why the space complexity of Python is better than Java.
  • Python snippets require much effort compared to Java.
  • Python snippets, for a specific functionality, requires less lines or statements compared to to Java.
  • Python snippets are 3-5 times shorter than a Java snippet for the same functionality.
  • Java is categorized as a low-level implementation language whereas Python is a high-level or glue type language.
Example

Snippet | Python

  1. Print (“GoodBye World!”)  
Snippet | Java
  1. public class GoodByeWorld {  
  2. public static void main(String[] args)   
  3. {  
  4. System.out.println("GoodBye World!");  
  5. }  
  6.   
  7. }  
Output
 
GoodBye World

Python VS C++

  • Python snippets are comparatively 5-10 times shorter than a C++ snippets for the same functionality.
  • Python is a high-level language and C++ is low-level.
  • Python acts as a glue language to combine components written in C++.
  • Python provides much flexibility in calling functions and returing values in comparision to C++.
  • C++ snippets work faster than Python.
  • Python is interpreated whereas C++ is a compiled.
  • Python uses Garbage Collection whereas C++ doesn't.
Example

Snippet | Python
  1. Print (“GoodBye World!”)  
Snippet | C++
  1. #include <iostream>  
  2. void main()  
  3. {  
  4.    cout << "GoodBye World!";   
  5. }  
Output
 
GoodBye World

Python VS Perl

  • Perl emphasizes support for Common Application oriented tasks (for example, file scanning, report generation and so on) whereas Python emphasizes support for Common Programming Methodologies (for example, Data Structure Design, OOP concepts and so on).
  • Python is much more maintainable and reuable than a Perl Snippet.
  • Python is a high-level language whereas Perl is middle-level.
Example

Snippet | Python
  1. Print (“GoodBye World!”)  
Snippet | Perl
  1. print "GoodBye World!";  
Output
 
GoodBye World

Python VS JavaScript

  • JavaScript is all about classes whereas Python deals simply with functions and variables without getting entangled in class definitions.
  • Python provides better code reusability than JavaScript.
  • Pyhton is better in scalability and maintainability.
  • Python is a high-level language whereas JavaScript is low-level.
Example

Snippet | Python
  1. Print (“GoodBye World!”)  
Snippet | JavaScript
  1. <html>  
  2.     <head></head>  
  3.     <body>  
  4.         <script>  
  5. alert('GoodBye, World!')  
  6. </script>  
  7.     </body>  
  8. </html>  
Output
 
GoodBye World

Python VS TCL

  • Python is a rich programming language when we talk about data structures whereas TCL traditionally stores all data as a string.
  • The space complexity of a Python snippet is much less than of TCL.
  • For extended functionality or high-level development, TCL lacks features (modular namespaces). That's why TCL usually contains TCL extensions written in C whereas Python is stand-alone and sufficient for any type of functionality and doesn't require extensibility in any other language.
Example

Snippet | Python

  1. Print (“GoodBye World!”)  
Snippet | TCL
  1. $ vim GoodByeWorld.tcl  
  2. puts "GoodBye World!"  
Output
 
GoodBye World

Python VS Smalltalk

  • Python contains dynamic binding and dynamic typing whereass Smalltalk lacks both, however it is also an object oriented language (the first object oriented language).
  • Python contains a rich library. It has more features for dealing with the internet, the web such as www, FTP and so on whereas Smalltalk's standard library of collection data types are refined.
  • Smalltalk follows a monolithic approach whereas Python has a different and separate development and environment distribution of code.
Example

Snippet | Python
  1. Print (“GoodBye World!”)  
Snippet | Smalltalk
  1. #include <stdio.h>  
  2. void main()  
  3. {  
  4.     printf("GoodBye World");  
  5. }  
Output
 
GoodBye World!

Python VS PHP

  • Python is much more maintainable than PHP.
  • Pyhton snippets execute much faster than PHP (95% faster).
  • Python is better than PHP whenever we talk about developing better scalable applications.
  • Pyhton is much more stable and upward compatible than PHP.
  • Python is an object oriented language whereas PHP is structure based.
  • The space complexity of Python is much less than Python.
Example

Snippet | Python
  1. Print (“GoodBye World!”)  
Snippet | PHP
  1. <html>  
  2.     <head>  
  3.         <title>PHP Test</title>  
  4.     </head>  
  5.     <body>  
  6.         <?php echo '  
  7.         <p> GoodBye World!</p>'; ?>  
  8.     </body>  
  9. </html>  
Output
 
GoodBye World!

Guidelines from my Side

  • Do as much code as you can.
  • Code anything you want, that is the best way to learn.
  • Don't just study things, try to learn them.
  • Work on your concepts.
  • Work on the fundamentals of any technology or stuff you want to learn.
Moto

“Keep calm and code Python”.

I tried to make it interesting and an interactive article and I wish you guys will like that, meanwhile if you have any suggestions then your welcome.

Until the next part, keep sharing.
 


Similar Articles