Trying to choose between python and java

Paul Melis paul at science.uva.nl
Tue May 15 03:38:43 EDT 2007


Anthony Irwin wrote:
> Hi All,
> 
> I am currently trying to decide between using python or java and have a 
> few quick questions about python that you may be able to help with.
> 
> #1 Does python have something like javas .jar packages. A jar file 
> contains all the program files and you can execute the program with java 
> -jar program.jar
> 
> I am sort of hoping python has something like this because I feel it 
> makes it easier to distribute between platforms e.g. linux, mac windows 
> etc.

It depends on what you see as the benefit of jar's. If it is purely a 
matter of packing your whole application up into a single file that you 
can distribute then there are a number of tools to do that, each with 
their limits. Search for cx_freeze or py2exe (win32 only).

> #2 What database do people recommend for using with python that is easy 
> to distribute across linux, mac, windows.

You could use sqlite, which comes included with Python 2.5. The database 
files it creates are cross-platform usable and using sqlite saves you 
the trouble of having to set up a database server

> #4 If I write a program a test it with python-wxgtk2.6 under linux are 
> the program windows likely to look right under windows and mac?

Likely yes, but guaranteed no. You'll simply have to test to see how 
your program comes out on the other platforms. You could use a GUI 
toolkit that draws its own widgets instead of one that uses the native 
controls, like wxPython does. PyGTK comes to mind, not sure if it is 
available on the Mac.

> #5 someone said that they used to use python but stopped because the 
> language changed or made stuff depreciated (I can fully remember which) 
> and old code stopped working. Is code written today likely to still work 
> in 5+ years or do they depreciate stuff and you have to update?

The changes I can remember from the last couple of years seem to be 
mostly addition of new features to the language and more standard 
modules being included in the standard Python distribution. Of course, 
some things were deprecated, but I think actual code-breaking changes 
were not that common. But with Python 3.0 (still a long time to go) 
there will definitely be some incompatibilities, but a lot can probably 
be fixed automatically using an included conversion tool.

Here's a description of the changes in the last 3 releases (2.5, 2.4, 
2.3). These span a bit more than 3 years, as 2.3.0 was released on July 
29th, 2003, with 2.5.0 on September 19th, 2006. Perhaps you can get a 
feel for the kind of changes from one release to the next.

http://docs.python.org/whatsnew/whatsnew25.html
http://www.python.org/doc/2.4/whatsnew/whatsnew24.html
http://www.python.org/doc/2.3/whatsnew/

> Also does anyone else have any useful comments about python vs java 
> without starting a flame war.

I guess it all depends on what you're going to use it for and what your 
goals and restrictions are. I've never seriously used Java (only a bit 
of C#), but I've been developing a GUI app with wxPython for the last 
couple of months and am pretty happy with it. Before that, I did lots of 
tooling with Python (conversion scripts, small computational stuff, etc) 
and was happy as well. So overall, I'm happy with Python :)

It's pretty powerful for a wide variety of applications, comes with a 
large collection of modules for everything from networking to file 
compression to encryption to xml parsing to database handling to ... 
(see http://docs.python.org/lib/lib.html). I find code in Python to be 
more easily readable because of the absence of unneeded brackets and the 
fact that code that forms a block is always aligned properly (eeek, 
possible flame-war subject here). And it saves on the number of type 
strokes as well. Overall, great stuff!

Paul



More information about the Python-list mailing list