CRM Newsletter
 
NEWSLETTERS
 

CIO.com updates, insights and advice on technology, management and your career.

 
 
 
LEADERSHIP
 
CIO Executive Programs
The Leader in Face-to-Face Education for Senior Executives

Offering regional and national programs, CIO (and CSO) events bring together some of the most respected names and thought leaders in information technology and security. Presented by CIOs and other senior level executives, these invitation-only programs offer timely topics and strong networking. Learn More »

 
CIO Executive Council
A Peer-Advisory Service and Professional Association for CIOs

Turn Geeks into Leaders

June 17, 11:30 AM - 12:30 PM U.S./ET (GMT-4)

Larry Bonfante, CIO of the U.S. Tennis Association, will discuss the skills and approaches that your rising IT leaders must learn to be effective in an executive capacity.

How to Handle Your New CEO: Managing Turnover at the Top

June 18, 11:00 AM - 12:00 PM U.S./Eastern (GMT-4)

Turbulent times have increased turnover at the top. Find out what Council CIOs have done to "break in" new CEOs—build relationships, set expectations, educate on the role of IT.

Mid-Market CIO Panel: Tips and Techniques for Improving Vendor Relationships

July 15, 4:00 PM - 5:00 PM U.S./Eastern (GMT-4)

We'll highlight relationship priorities and best practices identified in a Council study, and we'll interact with a CIO panel on the approaches they've used to improve strategic vendor partnerships.

Executive Competencies Assessment Tool

Assess Your Business Leadership Skills with the Council's new benchmarking tool. Rate yourself in change leadership, strategy, customer focus and more.

More / Register »

Learn more about the CIO Executive Council »



 
 
RESOURCE CENTER
 
 
 
SUBSCRIBE TO CIO
 
Are you involved in setting the direction for your company's IT budget or strategy?

Apply today for a FREE subscription to CIO Magazine!

 
 
 

You Used Python to Write WHAT?

Python is a powerful, easy-to-use scripting language suitable for use in the enterprise, although it is not right for absolutely every use. Python expert Martin Aspeli identifies when Python is the right choice, and when another language might be a better option.

 

February 19, 2008CIO

Programming language decisions often come down to personal preference and experience. Most modern languages are capable of performing the majority of programming tasks and include the necessary libraries to be useful day to day. Sometimes, interoperability concerns can dictate a particular platform, but nowadays, interoperability is commonly best achieved through XML interchange, shared SQL databases or Web services.

Therefore, when choosing a language for a particular purpose, it is often more important to look at how a language is designed, what it makes particularly easy, and what it makes more difficult. If features or performance do not detract, intangibles such as "feel," "elegance" and a sense of programmer productivity should be given serious weight.

Python is a powerful, opinionated and idiosyncratic scripting language, loved (and hated) by programmers the world over for its style, syntax and attention to whitespace. It excels as a "glue" language for putting together applications quickly, and many Python developers feel more productive in Python than in other languages. This article shows you why, and also points out situations when Python is perhaps not such a good choice.

First, let's take a quick look at the way Python works: a very short technical overview (suitable even for nontechnical managers).

To give you a feel for how Python looks, here is a short code snippet:

def say_hello(name):
      """ Issue a familiar greeting
      """
      print "Hello %s" % name
  
  say_hello("Guido")

You may not know much about Python, but you can probably guess what's going on. This is Python's single best feature: Things generally work the way you expect. This obviousness in syntax makes the language relatively easy to learn for new programmers and easy to remember for occasional ones. However, the fact that it differs substantially from most other languages can be a barrier.

Programming the Way Guido Indented It

Python was created by Guido van Rossum, its "Benevolent Dictator for Life." The language and its standard library are developed by a thriving open-source community, but under Guido's watchful eye, Python's consistency and spirit remain intact. First released in the 1990s, Python is still evolving today.

Python is fully object oriented and includes a few functional programming constructs. It also has built-in support for commonly used data structures such as lists, dictionaries and sets. Its creators emphasize readability, consistency and simplicity; they believe that programming languages should be concise, but not too clever for their own good.

The main implementation of Python is written in C and runs on virtually any modern platform. There are also implementations that run inside a Java Virtual Machine (Jython, JPype), on the .Net platform (IronPython) and even one written in Python itself, called PyPy.

The C implementation is highly optimized, and is usually more than fast enough for normal programming tasks. However, if raw speed is your primary priority, look to a compiled language such as C. For embedded systems with limited memory, Python's runtime overhead may also be a problem.

Python as a General-Purpose Language

Python is the default choice of scripting language for many developers. In the words of one Pythonista, it is rare to start a project with Python and discover that it was an entirely inappropriate choice as it grows, because Python scales both in project size and performance. That said, the degree of freedom that the language grants developers means they sometimes have to be a little more disciplined in how they structure their code.

It takes almost no effort to get started with Python. At its simplest, you can just launch the python interpreter and type away in interactive mode. The results of your statements are printed to the console immediately:

$ python
>>> price = 30.0
>>> quantity = 2
>>> print "Total: %f" % round(price * quantity)
The total cost is 60.0

Of course, this is useful only for very simple tasks, but save those statements to a file with a .py file, run that file through the interpreter and the script is executed.

As programs grow more complex, developers may define functions and classes and split code across multiple modules, or source files that make up the same program. Modules can be organized into packages, which can be turned into distributable, self-contained bundles (known as eggs).

You can find thousands of free Python packages at the Python Package Index. For day-to-day tasks, Python's standard library includes everything from shell interaction to file management, XML and CSV manipulation, and much more.

Python has a strong role in business computing, particularly in Web and enterprise development. Let's take a look at when it's the best (and not-so-best) choice.

 
 
Loading...
 
WHITE PAPERS

Brocade and Imperva: Providing Best-of-Breed Products

Web applications have become the backbone of business in nearly every segment of the economy.
 

How is Open Source Changing the Face of Enterprise Software?

Ensure success with your Operational Performance Management initiative.
 

Improve Code Quality Across Your Software Organization

Address developer skills and software processes, and you will eliminate many software quality issues.
 

Maximum Efficiency Gains with Virtualization

Learn best practices to optimize your infrastructure and operations department and gain the most from virtualization.
 

Manage Virtualization Initiatives

Learn how you can better manage virtualization initiatives to recognize this technologys maximum value.
 

Cost Effective Data Loss Prevention

Learn how Data Loss Prevention technologies can in fact be deployed in a cost effective manner.
 

WEBCASTS

IT Consolidation Made Easy

The Primary IT Initiative for Reducing Costs
 

Webcast with Dan Vesset: Investing in Business Analytics Technology

What exactly is business analytics and why should you care? Dan Vesset of IDC and Gaurav Verma of SAS answer this a...
 

Capitalize on Your SAP Content

After 18 years of partnership and over 3,000 successful customer deployments, Open Text has become SAP's premier pa...
 

Enterprise Cloud Computing: Ready for Primetime?

The progression toward enterprise cloud computing is happening today, as industry leaders deploy technologies that ...
 

Preparing Your Business Services for the Future

Would you trust your network monitoring tools enough to know when something is truly halting a business service? Wh...
 

Enterprise System Management Challenges in Big Organizations with Eli Almog

In this Podcast with Eli Almog, Corporate Architect in BMC's CTO Office, discusses how IT managers can know when it...
 

Resource Alerts

Get instant email notifications by topic when white papers, webcasts, and case studies are added to our library.

 
FEATURED SPONSORS
 
 
 
SPONSORED LINKS
 

How Open Source is Changing the Face of Enterprise Software

The Link Between Effective Online Business Banking and Web 2.0

Get Google Enterprise Search for your business information.

Accenture IT Consulting: Enabling high performance. More...

Top Five CIO Challenges

Insight makes it easy to spend your Microsoft subsidy check.

Five minute business analytics assessment. Immediate results.

Dangerous Collaboration Practices: 5 Ways IT Can Minimize Risk

Accenture: Outsourcing for uncertain times. Click to learn more.

Payback in 9 months with CA Spectrum solutions

The Case for Investing in Business Analytics Technology. Read white paper.

Live Webinar: Applying Business Analytics. Click here to learn more

Seven Ways ITIL Can Help You in an Economic Downturn

Developing A Dynamic, Real-Time IT Infrastructure

Maximizing the Business Value of the PC Infrastructure

Communications and Collaboration Needs at Business Organizations

Using Open Source to Deploy Web Applications

Cloud Computing: Read about VMware's compelling vision & set of products

Enterprise PBX Buyer's Guide

Secondary Market Primer: Your Network at Half Price

How Interactive Viewer Reduces the Effort to Meet Visualization Requirements

Stop Application Fraud at the Source with Device Reputation

Learn about the VMware vSphere (TM) & Intel (R) Xeon (R) Processor 5500 Series

Learn how a virtualized enterprise can help your company reduce costs

Why Isn't Server Virtualization Saving Us More?

Software Executives: Take Control of Your Organization's Code Quality

Forrester: Implementing Rich Internet Applications

Introducing the new HP ProLiant G6 server family

Accenture: Outsourcing for Competitive Advantage. More...

Better spam protection with Postini for just $1/user/mo

Introducing the new HP ProLiant G6 server family

infoBOOM! - The Mid-Sized Company CIO's Exclusive Community

Accenture IT Consulting: Logical meets technological. More . . .

The Fraudster Economy Model: Operating a Business in the Underground

Get agile IT security with CA Security Management

Trade in your old laser printer and get up to $1000 back!

Taking the Service Desk to the Next Level

Revolutionizing Enterprise Application Deployment

Why Data Loss is Increasing--and What You Can Do About It

Data Loss Prevention: A Better Way to Approach Security

Learn how to managing client systems in the enterprise.

Build a High-Performance Open Web Platform

Mid-Sized Company CIO Community: infoBOOM!

Enterprise PBX Comparison Guide

Getting Value from Outdated Networking Equipment

Top-line Performance that's Bottom-line Efficient

White Paper: 8 Key Ingredients to Building an Internal Cloud

Read about virtualization and consolidation effort best practices

Building the Virtualized Enterprise with VMware Infrastructure

The Global Marketplace Today: Strategies for Tough Times