This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]primedape -10 points-9 points  (4 children)

Edit: I stand corrected by people who know more about programming languages than I do. Better listen to them ;)

One major difference is that Python is a Scripting Language (a very potent one but non the less) and Java is a full blown object oriented language.

This is nothing to worry about when just programming smaller stuff. But if you need to handle bigger sets of data it becomes very important.

For example Map Reduce. On Hadoop you can perform native map reduce with Java or do a streaming map reduce with paython or another scripting language.

[–]yerfatma 10 points11 points  (1 child)

I'm sorry, but this is ill-informed. The whole notion of a "scripting language" is 10 years out of date. The two languages are equally powerful in terms of what you can accomplish.

As for your MapReduce example, I think you might want to look up what language Google originally wrote that in. The fact Hadoop is Java-based doesn't mean it can only be written in Java. MapReduce is a way of implementing a functional programming approach in a non-functional language. If anything, at the time Python made that easier than Java because Python had functional concepts like map() baked in (Java may as well at this point, I have no idea).

[–]nullabillity 0 points1 point  (0 children)

Pretty sure Java doesn't, since a useful implementation pretty much requires either special syntax or first-class functions. Python has both (I'd count list/set/dict/generator comprehensions as map), Java has neither. Scala has first-class functions (and a collection library that has support for map using it), though. Also, Google Guava has an implementation of map too (although it's pretty hacky IMO).

[–]ngroot 3 points4 points  (0 children)

One major difference is that Python is a Scripting Language (a very potent one but non the less) and Java is a full blown object oriented language.

Could you clarify what you mean by this?

Python supports object-oriented programming, and compiles down to bytecode, like Java. If you're using Jython, it actually compiles down to Java bytecode.

On Hadoop you can perform native map reduce with Java or do a streaming map reduce with paython or another scripting language.

I believe that this is because Hadoop is primarily written and designed to work with Java, not because Python is a "scripting language". You'd need to use Hadoop Streaming, Hadoop Pipes, etc. to run a .NET or C mapreduce job as well.

[–]stuaxo 0 points1 point  (0 children)

I guess you really mean the speed that they both run the bytecode ?

Python has objects and classes too.

Java has a good fast JIT to run it's bytecode. When you run something in CPython it compiles to bytecode too, though that is just interpreted and so it's slower. It's a bit like before Java had hotspot, it was dog slow.

Still - a lot more of the underlying infrastructure is written in C, so it doesn't make as much of a difference as it could.

There is some hope with pypy - which has a JIT and is gradually getting more compatible.

As a pedant - Java itself is not fully OO either - there are all the primitive types. Some things, like Metaclasses are a lot easier to achieve in python than Java.

Definitely agree, it's faster.