aspose file tools*
The moose likes Jython/Python and the fly likes Think Python: Java Comparison Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Think Python: Java Comparison" Watch "Think Python: Java Comparison" New topic
Author

Think Python: Java Comparison

Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 176
Hi Allen good luck with the book.

I read the free part of the book on Amazon and was intrigued how you started writing a college book on Java and it turned into Python, I am assuming non-polymorphically

But this does lead me onto several question about Python which I know absolutely nothing about.

Is Python based on Java or a subset of it?

Does the easier learning mean Python is inferior to Java in its capabilities.

Is knowing Java detrimental to learning Python as I saw you teach Python to new students.

Thank Kevin.


Java5 Tutorials | Java6 Tutorials | HTML/CSS Tutorials | JavaScript and jQuery Tutorials
Allen Downey
Author
Greenhorn

Joined: Sep 07, 2012
Posts: 25

Hi Kevin,

Lots of interesting questions. Python is not based on Java in any way (that I know of). According to the Wikipedia pages, Python was released before Java was designed, so it might be the other way around.

The semantics of the two languages are very similar, so it is easy to go from one to the other, but I think the similarities are due to convergent evolution, not common ancestry.

Since Python is easy to learn, you might suspect that there are limitations that come with simplicity, but I don't think that's true. Python scales up nicely to large projects and comes with industrial-grade libraries. The only limitation I can think of is that, because it is dynamically-typed, you get less error-detection at compile time. So some errors that would be caught at compile-time in Java would instead not be caught until run-time in Python.

And you asked if knowing Java makes it harder to learn Python. Definitely not. I see students make that transition all the time, and it is pretty much seamless.

Allen

All of my books are available from http://greenteapress.com
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

Kevin Florish wrote:
Is Python based on Java or a subset of it?


No, but there is Jython, which is an implementation of Python that runs on a JVM. This allows you to do cool things like script a Java program using Python.

Kevin Florish wrote:Does the easier learning mean Python is inferior to Java in its capabilities.


I'm hard pressed to think of functionality in the Standard Edition of Java that isn't in the Python API.

Kevin Florish wrote:Is knowing Java detrimental to learning Python


I don't think so. Python is different, but the same principles of object-oriented programming can apply to Python.


[How To Ask Questions On JavaRanch]
Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 176
Thanks for the answers guys.

Python certainly looks like something I might take a gander at.

Cheers Kevin.
Stephen Paulsen
Greenhorn

Joined: Sep 11, 2006
Posts: 9
Joe Ess wrote:
No, but there is Jython, which is an implementation of Python that runs on a JVM. This allows you to do cool things like script a Java program using Python.


Another nice thing about Jython is that you can not only script a Java program, you can write a program that is a combination of Python and Java - maybe to re-use classes, or write your UI pieces in Java/Swing while rapidly coding the connections in Python.

I've also used Jython to load up some Java classes to unit test them or experiment interactively with them. Being able to interactively call methods without having to write a test "main" or re-run a test program is pretty cool.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Think Python: Java Comparison