- The 20 Best iPhone/iPad Games of 2013 So Far
- 9 Steps to Build Your Personal Brand (and Your Career)
- 7 Consumer Technologies Coming to an Enterprise Near You
- 11 Signs Your IT Project is Doomed
Network World - Way back in 1999 we took a quick look at a language named Python, but we hardly did it justice because Python is definitely worth a serious look.
To briefly recap: Python, to quote the summary on python.org, is "an interpreted, interactive, object-oriented programming language [that] combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high-level dynamic data types and dynamic typing. There are interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac, MFC). New built-in modules are easily written in C or C++. Python also can be used as an extension language for applications that need a programmable interface."
Python is easy to learn and can be used for Web server scripting as a CGI interpreter. It also has support for creating and manipulating graphics, and generating and parsing HTML and XML.
But best of all, Python is open source freeware even for commercial use and runs under all sorts of operating systems, including Windows, DOS, Macintosh, Linux, Solaris, OS/2, Amiga, AROS, OS/400, BeOS, OS/390, z/OS, Palm OS, QNX, VMS, EPOC (Psion), RISC OS, VxWorks, PlayStation, Sharp Zaurus, and Windows CE or Pocket PC.
And if that's not enough there's Jython, which is Python implemented in, and certified as, 100% pure Java. Like Python, Jython is freely available for commercial and noncommercial use, and is distributed with source code.
Jython is fabulous. You can add the Jython libraries to Java applications as a scripting language, and Jython's interactive interpreter interacts with Java packages or with running Java applications so you can debug or experiment with wild abandon.
It is claimed that Python programs are anything from two to 10 times shorter than equivalent Java programs, and you can mix Python and Java code with the same wild abandon that you applied to the interactive interpreter.
What got us interested in Python all over again was the release on April 25 of Python 2.3b1 (the first 2.3 beta) for Windows, along with sources that are reputed to compile and run under OS X and, presumably, under Unix. A second beta version is due this month, and a final release is scheduled for July.
By now you must be wondering what Python looks like? Once installed, you can run the Python interpreter as a command-line interpreter or through the included shell called Idle (essentially a GUI for Python, and no, we have no idea why it is called Idle but suspect some convoluted connection to Eric Idle of Monty Python fame).
OK, download the latest release for your platform and install it. We'll wait.
Now let's run up Idle and at the command prompt (this defaults to ">>>") enter the classic first program:
print "Hello World"
That's it. Looks exactly like BASIC, doesn't it? Boring. But hang in there, it gets better. Here's a script called geturl written by Sean Reifschneider that retrieves a URL and sends it to stdout:
#Copyright (c) 1998 Sean Reifschneider,tummy.com, ltd.
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
if len(sys.argv) != 2:
print 'usage: %s <url>' % sys.argv
data = urllib.urlopen(sys.argv)
for line in data.readlines():
To run this you enter "python geturl.py" (for details see the entire geturl.py script) from the system command line (obviously tailored appropriately for your environment). You will see the raw HTML code shoot past.
And take a look here for a much more complicated example (still only 25 actual lines of code) that produces the MD5 hash value for each file specified on the command line. Cool.
Read more about software in Network World's Software section.