Why would I learn Python over other languages?

Roy Smith roy at panix.com
Thu Jul 8 14:26:25 CEST 2004

"Charif Lakchiri" <charif at kuc.biglobe.ne.jp> wrote:
> It is easy to learn?

Yes.  Simplicity and ease of learning were major design criteria.  There 
is also a large and active user community who can provide help, 
guidance, and the occasional group hug.

> Does it support GUI programming?

Yes.  There are several GUI libraries available.  I don't do much GUI 
programming, so I'll leave it to others to describe those.

> Does it support server-side programming, say for web apps?

Yes.  There are a variety of ways to do this.  At the low-level, there's  
CGI module.  There's a mod-python for Apache.  There's a sample HTTP 
server that comes with the system which you can extend on your own.  I 
recently saw mention of a JSP container for writing servlets in Python.

> Does it have extensions and libraries, say for DB connectivity, serial com 
> or network programming...?

Yes.  There is a standard DB API, and adapters for all of the major 
databases (Oracle, Sybase, MySql, etc).

> Can it be used for administrative tasks, say as perl...?

Yes.  There are modules for interacting with the file system and 
operating system (process control, etc).  If you want, you can execute 
external commands and capture their output, just like popen in perl.

> Also, can it be compiled to native code?

Yes.  The compiler is called "psyco", and it's very easy to use.

> Also much appreciated would be simple comparisons with say JAVA (my other 
> candidate), and pointers to sites and docs where to start.

A quick Java. vs. Python comparison:

Java uses a C-like syntax, Python uses it's own.  The Python syntax is 
very easy to learn.

Java uses static typing, Python uses dynamic typing  That means Java 
programs are full of typecasts and variable declarations and useless 
drek like that.  On the other hand, since you've pushed a lot of 
checking off to run time, Python takes a performance penalty.

Java is very much into data hiding, with private/protected/public 
keywords to declare classes and variables.  In Python, everything is 
public by default.  There are some ways to do weak data hiding if you 

Both compile to byte-code which runs on a virtual machine.  The 
underlying VM's are similar enough that there is a version of Python 
which compiles to java byte code and runs on a JVM!  One big difference 
is that the compile step is explicit in Java, but happens automatically 
and behind the scenes in Python.  This means you can just fire up an 
interactive Python session and type code at it to try things out, which 
turns out to be incredibly useful.

Both are object-oriented.  Java is a bit more extreme in this philosophy 
(i.e. everything is a class).  In Python, you can write non-OO code if 
you want, and that's often easier for quickie one-off scripts such as 
are common in sysadmin work.

If you are just starting out, I would definately learn both.

More information about the Python-list mailing list