Online Book Reader

Home Category

Learning Python - Mark Lutz [21]

By Root 1525 0
code (e.g., instructions for an Intel chip), some programs will run more slowly in Python than in a fully compiled language like C.

Whether you will ever care about the execution speed difference depends on what kinds of programs you write. Python has been optimized numerous times, and Python code runs fast enough by itself in most application domains. Furthermore, whenever you do something “real” in a Python script, like processing a file or constructing a graphical user interface (GUI), your program will actually run at C speed, since such tasks are immediately dispatched to compiled C code inside the Python interpreter. More fundamentally, Python’s speed-of-development gain is often far more important than any speed-of-execution loss, especially given modern computer speeds.

Even at today’s CPU speeds, though, there still are some domains that do require optimal execution speeds. Numeric programming and animation, for example, often need at least their core number-crunching components to run at C speed (or better). If you work in such a domain, you can still use Python—simply split off the parts of the application that require optimal speed into compiled extensions, and link those into your system for use in Python scripts.

We won’t talk about extensions much in this text, but this is really just an instance of the Python-as-control-language role we discussed earlier. A prime example of this dual language strategy is the NumPy numeric programming extension for Python; by combining compiled and optimized numeric extension libraries with the Python language, NumPy turns Python into a numeric programming tool that is efficient and easy to use. You may never need to code such extensions in your own Python work, but they provide a powerful optimization mechanism if you ever do.

Who Uses Python Today?

At this writing, the best estimate anyone can seem to make of the size of the Python user base is that there are roughly 1 million Python users around the world today (plus or minus a few). This estimate is based on various statistics, like download rates and developer surveys. Because Python is open source, a more exact count is difficult—there are no license registrations to tally. Moreover, Python is automatically included with Linux distributions, Macintosh computers, and some products and hardware, further clouding the user-base picture.

In general, though, Python enjoys a large user base and a very active developer community. Because Python has been around for some 19 years and has been widely used, it is also very stable and robust. Besides being employed by individual users, Python is also being applied in real revenue-generating products by real companies. For instance:

Google makes extensive use of Python in its web search systems, and employs Python’s creator.

The YouTube video sharing service is largely written in Python.

The popular BitTorrent peer-to-peer file sharing system is a Python program.

Google’s popular App Engine web development framework uses Python as its application language.

EVE Online, a Massively Multiplayer Online Game (MMOG), makes extensive use of Python.

Maya, a powerful integrated 3D modeling and animation system, provides a Python scripting API.

Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use Python for hardware testing.

Industrial Light & Magic, Pixar, and others use Python in the production of animated movies.

JPMorgan Chase, UBS, Getco, and Citadel apply Python for financial market forecasting.

NASA, Los Alamos, Fermilab, JPL, and others use Python for scientific programming tasks.

iRobot uses Python to develop commercial robotic devices.

ESRI uses Python as an end-user customization tool for its popular GIS mapping products.

The NSA uses Python for cryptography and intelligence analysis.

The IronPort email server product uses more than 1 million lines of Python code to do its job.

The One Laptop Per Child (OLPC) project builds its user interface and activity model in Python.

And so on. Probably the only common thread amongst the companies using

Return Main Page Previous Page Next Page

®Online Book Reader