Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programming in Python vs. programming in Java

Tags:

java

python

I've been writing Java for the last couple of years , and now I've started to write in python (in addition).

The problem is that when I look at my Python code it looks like someone tried to hammer Java code into a python format , and it comes out crappy because - well , python ain't Java.

Any tips on how to escape this pattern of "Writing Java in Python"?

Thanks!

like image 335
Yossale Avatar asked Mar 15 '10 12:03

Yossale


People also ask

Which programming is better Java or Python?

Although Java is faster, Python is more versatile, easier to read, and has a simpler syntax. According to Stack Overflow, this general use, interpreted language is the fourth most popular coding language [1].

Which is better for future Java or Python?

Python is more productive language than Java. Python is an interpreted language with elegant syntax and makes it a very good option for scripting and rapid application development in many areas.

What is the difference between Java and Python programming?

Java is a statically typed and compiled language, and Python is a dynamically typed and interpreted language. This single difference makes Java faster at runtime and easier to debug, but Python is easier to use and easier to read.

Which has more job opportunities Java or Python?

Besides, nowadays, artificial intelligence and automation-related jobs are more in the market; thus, preferring Python over Java is more. Therefore, if you are going to start your career by learning any programming language, then learning Python will be easier for you that will even help you to find a job easily.


2 Answers

You might consider immersing yourself in the Python paradigms. The best way is to first know what they are then explore the best practices by reading some literature and reviewing some code samples. I recommend Learning Python by Mark Lutz; great for beginners and advanced users.

You'll do yourself a great injustice if you program with Python and fail to leverage all of the built-in, developer-friendly, Pythonic syntax.

As my French teacher used to say, "French isn't just English with different words."

like image 160
Ryan Emerle Avatar answered Sep 25 '22 22:09

Ryan Emerle


If you are new to Python and coming from Java (or C#, or other similar statically typed OO language), these classic articles from PJ Eby and Ryan Tomayko are necessary reading:

  • Python Is Not Java (PJE)
  • Java is not Python, either (PJE)
  • Python Interfaces are not Java Interfaces (PJE)
  • The Static Method Thing (Tomayko)
  • Getters/Setters/Fuxors (Tomayko)
like image 44
Corey Goldberg Avatar answered Sep 23 '22 22:09

Corey Goldberg