Why should I learn Python instead of Java?
Why should I learn Python instead of Java?
81 Answers
Let's take the first program that's always mentioned in any programming language tutorial - yes - the 'Hello World' program.
In Java :
public class HelloWorld {
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
In C :
#include<stdio.h>
int main()
{
printf("Hello World");
}
In Python :
print "Hello World"
I guess now you see why you should learn Python!
In Java :
public class HelloWorld {
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
In C :
#include<stdio.h>
int main()
{
printf("Hello World");
}
In Python :
print "Hello World"
I guess now you see why you should learn Python!
Since I am a fan of C++, I will compare that with Python.
1. First and most important difference: Syntax
In C++ you normally get words that make sense with practice, but Python has a syntax very very similar to English commonly used while speaking. If you know SQL, then you can say Python syntax is somewhat similar to SQL except it is used for programming, not maintaining a database.
2. Level of Control/Programming:
C++ is considered an intermediate level programming language, i.e. it has some features where one can communicate with hardware directly while Python is a high-level programming language where no direct command to the hardware can be given by the programmer. This limits the programmer in Python, while C++ remains very powerful. In fact, it is the most powerful Object Oriented Language and has so far remained strong against the test of time thanks to this feature.
3. Code Size
Python would generally have smaller code size than C++ owing to the fact that in Python emphasis has gone to code readability. This is definitely an advantage especially when you reach debugging phase.
4. Constructs
Python introduces the Contruct library which has pre-defined code for data structures. One can define the data struct during declaration instead of having to perform any procedural programming unlike C++. However, I think C++11 onwards have some in-built libraries for data structures. Still, borland doesn't. And one shouldn't be using it anyway.
5. Interpreter
Python code goes through an interpreter before it is compiled, while C++ is pre-compiled. This makes C++ faster than Python (noticeable when making larger programs).
6. Memory Management
C++ has advanced tools like pointers to manage memory and gives a powerful tool to the programmer. In Python there are no pointers, but declarations for variables are also not necessary making memory management easier.
Overall:
Python is good for beginners, being a high level language which is easier to use and learn thanks to its memory management and syntax but is not quite as powerful as C++ or C nor as fast making C++ more efficient and a better, more powerful choice for experiences programmers than Python. However, for internet applications Python is a much better choice than C++ and it's success stories reflect that.
Major Applications in Python:
Youtube, DropBox, Google, Quora (yes, this Quora), Instagram.
One should learn Python especially if they are interested in going for internet applications or something. Learning could never hurt.
1. First and most important difference: Syntax
In C++ you normally get words that make sense with practice, but Python has a syntax very very similar to English commonly used while speaking. If you know SQL, then you can say Python syntax is somewhat similar to SQL except it is used for programming, not maintaining a database.
2. Level of Control/Programming:
C++ is considered an intermediate level programming language, i.e. it has some features where one can communicate with hardware directly while Python is a high-level programming language where no direct command to the hardware can be given by the programmer. This limits the programmer in Python, while C++ remains very powerful. In fact, it is the most powerful Object Oriented Language and has so far remained strong against the test of time thanks to this feature.
3. Code Size
Python would generally have smaller code size than C++ owing to the fact that in Python emphasis has gone to code readability. This is definitely an advantage especially when you reach debugging phase.
4. Constructs
Python introduces the Contruct library which has pre-defined code for data structures. One can define the data struct during declaration instead of having to perform any procedural programming unlike C++. However, I think C++11 onwards have some in-built libraries for data structures. Still, borland doesn't. And one shouldn't be using it anyway.
5. Interpreter
Python code goes through an interpreter before it is compiled, while C++ is pre-compiled. This makes C++ faster than Python (noticeable when making larger programs).
6. Memory Management
C++ has advanced tools like pointers to manage memory and gives a powerful tool to the programmer. In Python there are no pointers, but declarations for variables are also not necessary making memory management easier.
Overall:
Python is good for beginners, being a high level language which is easier to use and learn thanks to its memory management and syntax but is not quite as powerful as C++ or C nor as fast making C++ more efficient and a better, more powerful choice for experiences programmers than Python. However, for internet applications Python is a much better choice than C++ and it's success stories reflect that.
Major Applications in Python:
Youtube, DropBox, Google, Quora (yes, this Quora), Instagram.
One should learn Python especially if they are interested in going for internet applications or something. Learning could never hurt.







Comments
Post a Comment