Trying to choose between python and java

A

Anthony Irwin

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.

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

#3 Is there any equivalent to jfreechart and jfreereport
(http://www.jfree.org for details) in python.

#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?

#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?

Anyway hopefully someone can help me out with these last few questions
I have.

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


--
Kind Regards,
Anthony Irwin

http://www.irwinresources.com
http://www.makehomebusiness.com
email: anthony at above domains, - www.
 
M

Marc 'BlackJack' Rintsch

#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

There are .egg files but usually distributing a program consisting of
several files isn't a big problem. There is a mechanism to write a
`setup.py` that copies the files into the correct locations. Look for
`distutils` in the library docs.
#2 What database do people recommend for using with python that is
easy to distribute across linux, mac, windows.

From Python 2.5 the standard library contains SQLite support. There are
third party libraries to many DBMSs like MySQL, PostgreSQL, Oracle etc.

The situation with MySQL bindings under Windows was a bit troublesome
recently. The author of the bindings doesn't use Windows and does not
provide pre-built binaries.
#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 you better check. Same applies to Java GUIs.
#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?

That sounds odd because the language and standard library is very
backwards compatible. There are some things deprecated with a comment in
the docs and in some cases runtime warnings, but the code still works.

With Python 3.0 some things will break, because there's some cruft in the
language and library that accumulated over time, just because backwards
compatibility was such a high priority. The 2.x series will be supported
for some time parallel to 3.x, so there is enough time to migrate.

Ciao,
Marc 'BlackJack' Rintsch
 
T

Terry Reedy

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

Check out the sqlite3 module. (But I have not used it yet).

| #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?

Most versions of Python are still available. You are free to use and
distribute your copies indefinitely. Several older versions are still in
use.

Recent releases have added features but removed very little except bugs.
Unfortunately, bug removal sometimes breaks code. And feature additions
occasionally introduce bugs or otherwise break code, but that is why there
are alpha, beta, and candidate releases before a final release.

Python3 will remove many things at once. A conversion tool is being
written. And there is no expectation that production code should be
immediately converted, if ever.

Terry Jan Reedy
 
S

Steven Howe

Anthony said:
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.

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

#3 Is there any equivalent to jfreechart and jfreereport
(http://www.jfree.org for details) in python.

#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?

#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?

Anyway hopefully someone can help me out with these last few questions
I have.

Also does anyone else have any useful comments about python vs java
without starting a flame war.
Flame war? Here amongst all the reasonable adults programmers? It never
happens.

1) I always thought jar files were weird. Change the run mode on you
python script and just run it, over and over.
chmod u+x program.py
../program.py
No doubt you are (shudder) a Windows user (and beat yourself in the
closet at night as well). No doubt Windows has a feature to set the
privilege on a file to make it executable. With any luck, I'll never know.

2) Python interfaces with with damn near every database I've ever seen,
regardless if the database is on the same system or remote. At worst
case, it seems to have ODBC connection (yes I know, C and connect are
the same thing, like an American saying Mount Fujiyama, which is of
course, Mount Fuji Mount) feature. Not as precise as a targeted
connector, but it works. There are even multiple ways to 'see' the
database. As strings, lists, objects, rows, tables and dictionaries.
It's all quite a powerful tool. Image, getting to choose how you 'see'
the database. Who'd have thunk!

3) No idea about jfree. Perhaps a few keyword searchs on Google or
Sourceforge would give you an answer.

6) Never programmed wx. But it seems to be very stable on the programs
I've downloaded. Anyway mapping one GUI to another is always an
imprecise effort (especially when you have 235 patents on the product
that you dare not tell anyone about). No two mindset ever really meet,
especially when money is involved.

5) All languages grow. Get over it. But, if you keep the older
interpreter around, you can still run your old scripts. At NCR I had to
support 6 different version of Perl because the programmers wouldn't
fix/update their code. Seem they had better things to do and you can
always expect the Sysadmin to save your bacon.
But if you haven't got to that point (six version to support) yet,
during pre-upgrade tests, you might run the program and note the
features that are going to be decrepit. Generally you have a few minor
version releases (year or more) before the decrepit feature is dropped.
Then you can decide if upgrading/fix or running multiple version of
python is the right path for you. Using the PYTHONPATH environment
variable is a good way to redirect your older scripts to use decrepit
feature via an older interpreter.

The (6) you didn't ask. As a Sysadmin, I hate Java. It's a resource hog.
Little tasks take hundreds of megabytes of RAM. What can one expect.
It's a virtual machine inside your computer. Hog it must be! Python is a
bit slimmer on the memory footprint and I think a hell of a lot easier
to debug. Even strace can be used on python programs. Never got strace
to work on Java scripts.

The (7) you didn't ask. Last month there was a full flame war about
java/python on the python-list. It petered out after about 15 days. You
might review the archives to get a sense for yourself (so we don't have
repeat the war, just for you).

sph
 
P

Paul Melis

Anthony said:
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
 
A

Ant

#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

As someone else has said, Python has eggs: http://peak.telecommunity.com/DevCenter/PythonEggs
#3 Is there any equivalent to jfreechart and jfreereport
(http://www.jfree.orgfor details) in python.

I can't remember what it is I use - I haven't got access to my server
at the moment... But look in the cheese shop - I'm fairly sure it was
from there. I'll post details if I remember. Alternatively this looks
good (though I haven't tried it and it's only free for non-commercial
use): http://www.dislin.de
#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?

Any language will have some compatibility problems when upgrading to a
different version, and so you have the option of updating your program
or using an old version of the language. I'm a professional Java
developer, and though Java 6 has been out for some time now, every
company I've worked for in the last couple of years still uses Java
1.4 due to problems with the upgrade.

Python does strive however to stay backward compatible (3k not
withstanding), and I've upgraded from 2.3 to 2.4 and now 2.5 with no
problems.
Also does anyone else have any useful comments about python vs java
without starting a flame war.

As I said, I'm a professional Java developer, and much prefer
programming in Python when I can (and am even getting quite a lot of
Python work at the moment via Jython :) )
 
B

Bruno Desthuilliers

Anthony Irwin a écrit :
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

Python eggs
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.

Note that while highly portable (and ported), Python is not as autistic
as Java and doesn't try to pretend the underlying platform doesn't
exists...
#2 What database do people recommend for using with python that is easy
to distribute across linux, mac, windows.

If you're thinking of embedded databases, the answer is SQLite. Else,
PostgreSQL and MySQL both run on Windows and mowt unices.
#3 Is there any equivalent to jfreechart and jfreereport
(http://www.jfree.org for details) in python.

#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?

#5 someone said that they used to use python but stopped because the
language changed or made stuff depreciated
s/depreciated/deprecated/

(I can fully remember which)
and old code stopped working.

This is very strange, and even looks like FUD. Python has gone very far
into maintaining compatibility, and there's a lot of pretty old code
still running on latest Python versions.
Is code written today likely to still work
in 5+ years or do they depreciate stuff and you have to update?

I still use code written more than five years ago.
Anyway hopefully someone can help me out with these last few questions I
have.

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

Err... reading the last words, I think I'd better shut my mouth now.
 
G

Gabriel Genellina

En Tue, 15 May 2007 05:43:36 -0300, Bruno Desthuilliers
I still use code written more than five years ago.

Just as an example, PIL (Python Imaging Library) works unchanged with any
version from Python 1.5 (released 1999) till the latest 2.5 (released this
year)
 
N

Nick Craig-Wood

Anthony Irwin said:
#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?

wx adopts the native look and feel for the platform. I've used it
under linux and windows where it looks fine! I've never used it under
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 language does change gently. New language features are added.
Backwards compatibility is deemed very important. Read PEP 5
"Guidelines for Language Evolution" for more info.

http://www.python.org/dev/peps/pep-0005/

Libraries are deprecated but not removed. Read PEP 4 "Deprecation of
Standard Modules" if you want to know more.

http://www.python.org/dev/peps/pep-0004/

There is more churn in the libraries which aren't distributed with
python.

There is also the Python 3000 project. The point of this project is
to remove the deprecated stuff and the accumulated cruft and make
python shiny and new again. A lot of python programs will run
unmodified under Python 3000 anyway. However there is a translator to
translate to the new Python 3000 format. Python 3000 is probably a
year from its first stable release. I suspect it won't be in wide use
for several years after that.

http://www.python.org/dev/peps/pep-3000/

Don't be scared of Python 3000 though it is just a gentle revision of
the language, nothing like, lets say, going from perl 5 to perl 6.
Also does anyone else have any useful comments about python vs java
without starting a flame war.

You'll be a lot more productive writing python code in my experience
so if development time is important to you, then go with python.
 
P

Paul Boddie

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

Some people will propose Python .egg files, but I believe plain .zip
files containing packages may be enough for your purposes, provided
that there are no native code libraries inside.
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.

See also...

http://wiki.python.org/moin/DistributionUtilities
#2 What database do people recommend for using with python that is
easy to distribute across linux, mac, windows.

See the following pages for guidance:

http://wiki.python.org/moin/DatabaseProgramming
http://wiki.python.org/moin/ChoosingDatabase

You will probably be most interested in sqlite, particularly as
support for that database system is now part of Python's standard
library (from Python 2.5 onwards), although the libraries are also
available separately.

[...]
#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?

It's "deprecated", not "depreciated", by the way!

I tend to complain about changes in the language a lot, mostly because
I think that they can be confusing and off-putting for beginners, make
documentation and literature outdated, and distract from more
important areas of improvement, but I don't think that previous
language changes have necessarily caused me many problems. My own
active projects are at most around four years old, but as these
projects have developed, I think that language changes have been the
least of my problems. ;-)

People could use such things as an excuse to bash Python, but the
favourite languages of some of those people may well be undergoing
fundamental changes with substantial potential breakage and no
reasonable escape from the upgrade treadmill. Meanwhile, it's
completely possible to stick with a particular version of Python and
to write code against that without being forced to upgrade because of
stability issues. Indeed, Python has reached a level of maturity
(unlike certain competitors) where a conservative approach to version
adoption is completely viable: I'm using Python 2.3.x in my work, and
aside from a few conveniences that I miss from using Python 2.4.x
elsewhere, it's still very much a going concern.

Python 3.x will be somewhat different from Python 2.x, but people are
working on tools to help developers target both branches of the
language simultaneously, and it wouldn't surprise me if the 2.x series
continued in such a way that the differences between the branches get
smaller over time as developers gradually adopt the ways of the
refined 3.x language and libraries - this has been happening with Zope
2.x and Zope 3.x, in fact. Personally, I plan to stick with Python 2.x
for some time to come unless something really compelling shows up in
Python 3.x, and I even intend to hang on to Python 2.4.x for as long
as I reasonably can. There's no point in upgrading systems purely for
the sake of upgrading.

Paul
 
K

Kirk Job Sluder

Anthony Irwin said:
#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

Python does this with eggs and distutils that copy your files into the
proper location. For os x you also have py2applet which creates an
application bundle that can be put onto a disk image and dragged into
the Applications folder. A similar utility exists for MSWin, but I've
not used it.
#2 What database do people recommend for using with python that is
easy to distribute across linux, mac, windows.

pysqlite3 for python is included in python 2.5 and can be added to
python 2.4. For java you would probably use HyperSonic or Derby. At
least one winner in the java camp for me is db4o, which is a bit like
shelve on steroids with an object-oriented query language.
#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?

There are enough idiom differences between OS X, MSWin, Gnome and Qt
that native look and feel is very, very difficult to achieve. Java
comes close with SWT. WxPython applications seem to port badly to OS
X, and are tricky to build into an application bundle.

As a example of how these differences in idioms can become problems,
Mozilla Thunderbird on OS X regularly has issue with unmodified
keybindings. With Thunderbird 2.0 shift-J marks a message as junk,
even when you are entering text into a dialog box. The tkinter
application Leo uses the control key as a modifier on OS X rather than
the command key. The basic point is that you need to test on all
platforms you want to develop for.

My very biased view of the domain is as follows:
OS X/Cocoa: PyObjC
KDE + Win + OS X/X11: PyQt
Win + Gnome + OS X/Carbon: wxPython or Jython+SWT
Simple, easy, and universal: tkinter
Rich, complex, and universal: Jython+Swing
Also does anyone else have any useful comments about python vs java
without starting a flame war.

I've found it useful to use a mix of pure java and jython, although
I'm still working through some gotchas in regards to compiling jython
code that's acessible from java.
 
S

sturlamolden

#1 Does python have something like javas .jar packages.

Yes. .egg files.

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

Depends on your needs:

1. Berkely DB - not relational, zero administration, very fast
(bundled with Python).
2. SQLite - zero administration, quite fast (bundled with Python).
3. MySQL - relational database server, fast, GPL
4. Oracle - relational database server, sluggish, commercial
#3 Is there any equivalent to jfreechart and jfreereport
(http://www.jfree.orgfor details) in python.
Yes.

reportlab
matplotlib


#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?

Yes.

But you should test anyway.

#5 someone said that they used to use python but stopped because the
language changed or made stuff depreciated

Python is no worse than Java with respect to that.
 
B

Beliavsky

#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?

Because Python 3 will change the syntax of print to disallow

print "Hello, world."

a substantial fraction of Python programs in existence, including all
of my programs, will be broken. Draw your own conclusions.
 
S

sturlamolden

print "Hello, world."

a substantial fraction of Python programs in existence, including all
of my programs, will be broken. Draw your own conclusions.

In the vent that your Python 2.x install will be fubar and suddenly
stop working the day Python 3k is released: how difficult will it be
it to make a Python 3k script that corrects your code?
 
R

Robert Kern

sturlamolden said:
In the vent that your Python 2.x install will be fubar and suddenly
stop working the day Python 3k is released: how difficult will it be
it to make a Python 3k script that corrects your code?

It's worth mentioning that providing such a script is of high priority for the
Python 3.0 team. They've already implemented the translation for print
statements, too:

http://svn.python.org/view/sandbox/trunk/2to3/
http://svn.python.org/view/sandbox/trunk/2to3/fixes/fix_print.py?rev=54501&view=auto

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
A

Ant

I can't remember what it is I use - I haven't got access to my server
at the moment... But look in the cheese shop - I'm fairly sure it was
from there. I'll post details if I remember. Alternatively this looks
good (though I haven't tried it and it's only free for non-commercial
use):http://www.dislin.de

It's pychart that I use fr charting. Nice and simple to use - though I
only use it for simple charts, so I'm not sure how powerful it is.
 
A

Aahz

#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?

You're probably thinking of
http://www.gbch.net/gjb/blog/software/discuss/python-sucks.html

Thing is, while he has a point, I don't think it's a very good one. For
example, just yesterday in upgrading from Java 1.4.2 to Java 5.0, I had
to fix a bunch of instances of "package foo.bar.baz;" to "package baz;"
because apparently the latter is now "correct". Bugfixes happen, and
sometimes they break working code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top