About InfoWorld : Advertise : Subscribe : Contact Us : Awards : Events : Store
InfoWorld HomeNewsTest CenterOpinionsProduct GuideTechIndex
 COLUMN ARCHIVE  FORUMS
 

COLUMN

 
The Open Source
Nicholas Petreley

Caught in Python's grip

I'M A BIG FAN of the open-source programming language called Python. In case you're wondering, Python is indeed named after the British Broadcasting Corp. comedy group Monty Python. It was created in about 1990 by Guido van Rossum, a fan of Monty Python. Since then it has matured at a phenomenal rate, thanks to its open-source nature.

   ADVERTISEMENT
  

Free IT resource

Virtualization Insights from Top Experts - Learn how virtualization gets real!

Sponsored by Dell

Free IT resource

TechNet: More ways to know it, share it, and keep it running.

Sponsored by Microsoft

RELATED LINKS
»  AT&T buys high-speed wireless spectrum for $2.5 billion
»  Update: Sprint chief Forsee resigns
»  IT trainer offers master's degree for hackers
»  Wireless RSS feed 

IDG ENTERPRISE NETWORK
More Network LAN/WAN News...  (ComputerWorld)
Wireless EV-DO on board  (ComputerWorld)

TOP NEWS 


IT SOLUTION SEARCH

In its current state, Python miraculously manages to combine simplicity with incredible depth and breadth. On the one hand, Python is very similar to Java in how one might apply it to build solutions and the kind of features it supports. Like Java, it is object-oriented, runs byte code, and works well for server-side Web applications. Like Java, you can use Python to build client-side applets. Netscape has a plug-in for this, but nobody seems to use it and it's not supported anymore. Why does nobody use it? Because you can write applets in Python and compile them into Java byte code for use with any Java 1.1-enabled browser. These are but a few examples of Python's depth.

Unlike Java, Python is ideal for tossing together a quick script to do mundane work. If you're a casual Linux user, you have probably executed many Python scripts and applets without knowing it. People use Python this way because it is even easier to use for mundane tasks than Unix shell script languages and infinitely more powerful. That demonstrates its breadth.

I don't mean to rekindle the Python versus Java wars that raged a few years back. Both languages have their place. Neither is perfect for every need, although Python is closer to being a one-size-fits-all language than Java. But I happen to be as big a fan of Java as I am Python.

I draw the comparison because you would do well to consider both Python and Java if you're about to embark on a new Web application project. You just might find that Python is more appropriate for your particular task than Java.

One of the first things you'll notice about Python is its unique way of grouping statements. Python uses indentation to parse its code. Most C programmers tend to use indentation to make their code readable. You type an "if" statement, go to the next line, indent farther than the "if" statement, and then type the code that is executed if the condition is true.

Although C programmers don't have to use indentation, you do it simply because it makes it easier to understand the programming logic when you come back to the code later. In contrast, if you don't indent Python statements properly your program won't run. You can use tabs, spaces, or a mix of the two, but you have to be consistent.

That feels rather odd when you first start programming in Python, but it only takes a few minutes before you realize that it is not only an intuitive way to program, it pushes you to create code that is more readable, and therefore easier to maintain.

The other thing you'll notice is that it is as easy to create Python classes (objects) as it is to toss together a procedural script. So much so that you often end up using objects in Python even when you don't have to. This makes your code more reusable, which is always a good thing.

I've barely scratched the surface of what Python is and what it can do. If I've piqued your interest, visit www.python.org for more information. Once you learn your way around Python and are ready to start programming I recommend you pick up Programming Python by Mark Lutz, from the O'Reilly series, now in its 2nd Edition.Next week I'll discuss options available for server-side Web applications programming with Python.


Nicholas Petreley is the founding editor of VarLinux.org ( www.varlinux.org ) and LinuxWorld. Reach him at nicholas@petreley.com.




RELATED SUBJECTS

Software Development
Operating Systems

Discuss this article in our online forums

MORE >


SPONSORED WHITE PAPERS
EMC - Lower costs and improve reliability-Get the EMC CLARiiON white paper!
Ciphertrust - Are you ready for Sobig.G? Learn how to protect your email systems.
CDW - Personal attention. CDW. The Right Technology. Right Away.
EMC - Explore key performance features and capabilities of EMC ControlCenter 5.1.1.
Intel - Free Intel white paper shows you how to deploy a secure wireless LAN
Cisco - FREE WHITE PAPER: BLUEPRINT to design and implement secure VPNs
Verity, Inc. - "Mass Consolidation Hits the Web-Search Market"
McDATA - Download a FREE storage consolidation white paper from McDATA(R).
Lucent Technologies - Overcoming Common Firewall Limitations
Lucent Technologies - Leverage Your Mobile High Speed Data Access. Download Free White Paper!
Nokia - Get the scoop! Mobilizing business white papers & case studies.
BMC Software - Maximize the Potential of Enterprise Data: Free white paper!
Network Associates - Free white paper - Strategies for Optimizing Network Costs and Benefits
Entrust - Manage identities across applications. Improve productivity.
Stalker Software - CommuniGate Pro - Transform your Email and Calendaring
Remedy - A NEW Gartner Research Note:Producing Quality IT Services

Search the IDG White Paper Library:


SPONSORED LINKS

INFOWORLD MARKETPLACE


» Hot Stock Alert (TMDI)
Telemedicus - Medical Communication Top Telemedicine Technology
» Apply BPM and ITIL at your IT Help Desk
ServiceWise brings BPM to complete IT service while eliminating integration cost. Learn more here.
» EMC delivers high-speed image capture, storage
Learn how you can quickly capture, organize, and deliver information with EMC ApplicationXtender.
» Register for your free VMWare Virtualization kit!
VMware virtualization takes the cost and complexity out of IT  Download this free kit to learn how.
» FREE Sophos Threat Detection Test
Is your AV catching everything it should? Free virus, spyware and adware scan.




 HOME  NEWS  TEST CENTER  OPINIONS  PRODUCT GUIDE  TECHINDEX   About : Advertise : Subscribe : Contact Us : Awards : Events 

Copyright © 2008, Reprints, Permissions, Licensing, IDG Network, Privacy Policy

All Rights reserved. InfoWorld is a leading publisher of technology information and product reviews on topics including viruses, phishing, worms, firewalls, security, servers, storage, networking, wireless, databases, and web services.

Computerworld :: Network World :: CIO :: PC World :: Darwin :: CMO :: CSO
IT Careers :: JavaWorld :: Macworld :: Mac Central :: Playlist :: GamePro :: GameStar :: Gamerhelp
ITWorld Canada :: Computerwoche :: Techworld UK :: tecChannel :: IDG.se :: IDG.no