Python Success Stories
Python Success Stories
Success Stories
8 true tales
of flexibility,
speed, and
improved
productivity
Order Now
See back page for order form. Or call 800-998-9938
python.oreilly.com
Introduction
by Alex Martelli & Guido van Rossum
Python is widely admired for its simplicity Engineers since the Roman Vitruvius have
and elegance. However, these undeniable recognized that a good design exhibits
qualities must not overshadow Python’s solidity (firmitas), delight (venustas), and
usefulness: with Python, you *can get usefulness (utilitas). Italian architect, Leon
the job done*! Battista Alberti showed during the
Python is highly scalable–suitable for large Renaissance that these characteristics are
projects as well as for small ones, excellent achieved by harmony (concinnitas) the
for beginners yet superb for experts. It is art of ordering disparate parts into an
stable and mature, with large and powerful organized whole. Python’s design makes
standard libraries, and a wealth of third- these theories come to life, no less than
party packages for such widely varied tasks Alberti’s Tempio Malatestiano.
as numerical computation, Internet and web Managers love Python because its simplicity
programming, database use, graphical user minimizes programmers’ learning efforts,
interface development, XML handling, but the same simplicity underpins Python’s
image processing, three-dimensional solidity, avoiding any bugs related to
modeling, and distributed processing with obscure, misunderstood and ad-hoc features,
CORBA or SOAP. Python plays well with in both the language’s implementations and
others, easily integrating with either C/C++ programs coded in Python. Designers are
or Java you can extend it, you can embed drawn to Python’s elegance, which allows
it in your existing applications, and you concise and readable expression of design
can use it to integrate multiple applications. ideas, but the same elegance and readability
This booklet illustrates Python’s usefulness ease maintenance, modification and reuse
by presenting a small sample of Python for programs coded in Python. The ease of
success stories, real-life examples where interfacing Python to existing C/C++ or Java
Python played a central role in the devel- libraries and applications, plus Python’s
opment and delivery of working, useful large standard library and the wealth of
software systems of substantial size. The existing third-party Python extensions,
systems are in a wide variety of application combine to make Python the ideal
areas, and they go up the scale, all the language for challenging integration tasks,
way to enterprise-wide integrated systems. no less than for “green-field” development
Thus, you’ll see that Python is not just projects. All together, these characteristics
a scripting language (not limited to coding make Python the language of choice for
small and simple scripts, even though it’s high-productivity software development—
quite suitable for such frequent, small one of the most rapid development
tasks), nor is its usefulness confined to any environments on the planet.
one application area. In the hands of experi- Once this booklet has whetted your
enced software developers, Python offers appetite, you can explore Python further,
high productivity for projects of all sizes, starting at www.python.org. For many
in all application areas. excellent books about Python, and for
Python’s usefulness comes exactly from its additional Python success stories,
simplicity and elegance, harmonized into a see python.oreilly.com.
seamless whole by its highly pragmatic design.
1
Industrial Light & Magic Runs on Python
Tim Fortenberry
2
approximately eight hundred users daily, turns out, Python enabled much more
many of whom write or modify code for ILM than just process control.
that controls every step of the production Unlike Unix shell scripting, Python can
process. In this context, hundreds of be embedded whole as a scripting language
commercial and in-house software compo- within a larger software system. In this case,
nents are combined to create and process Python code can invoke specific functions
each frame of computer-generated or of that system, even if those functions are
enhanced film. Making all this work, and written in C or C++. And C and C++ code
keeping it working, requires a certain degree can easily make calls back into Python
of technical wizardry, as well as a toolset code as well.
that is up to the task of integrating diverse
and frequently changing systems. Using this capability, ILM integrated Python
into custom applications written in C or
Enter Python C++, such as ILM’s in-house lighting tool,
Back in 1996, in the 101 Dalmation days, which is used to place light sources into
ILM was exclusively an SGI IRIX shop, and a 3D scene and to facilitate the writing,
the production pipeline was controlled by generation, and previewing of shaders
Unix® shell scripting. At that time, ILM was and materials used on CG elements. It is
producing 15-30 shots per show, typically the lighting tool that is ultimately respon-
only a small part of each feature length film sible for writing the 3D scene out to a
to which they were contributing. format that a renderer can interpret
Looking ahead towards more CG-intensive and render.
films, ILM staff began to search for ways At the same time, more and more compo-
to control an increasingly complex and nents, such as those responsible for ILM’s
compute-intensive production process. many custom file formats and data structures,
It was around this time that Python version were re-wrapped as Python extension modules.
1.4 came out, and Python was coming into As Python was used more widely, extending
its own as a powerful yet simple language and customizing in-house software became
that could be used to replace Unix shell a lot easier. By writing in Python, users
scripting. Python was evaluated, compared could recombine wrapped software compo-
to other technologies available at the time nents and extend or enhance standard CG
(such as Tcl and Perl), and chosen as an applications needed for each new image
easier to learn and use language with which production run. This let ILM staff do
to incrementally replace older scripts. exactly what production needed at any
At ILM, speed of development is key, and given time, whether that meant allowing for
Python was a faster way to code (and re- a specific look for an entire show, or just a
code) the programs that controlled the single CG character or element.
production pipeline. As it turned out, even some of ILM’s non-
technical users were able to learn enough
Python Streamlines Production
Python to develop simple plug-ins and to
But Python was not designed just as a create and modify production control
replacement for shell scripting and, as it scripts alongside the technical users.
3
Industrial Light & Magic Runs on Python, continued
Python Unifies the Toolset Once Python was in use, it made the
Encouraged by its successes in batch production control system portable. This
process control and in scripting applica- gave ILM additional freedom in making
tions and software components, ILM started hardware technology choices, including a
to use Python in other applications as well. large-scale introduction of commodity PC
hardware and Linux, a move that has saved
Python is now used for tracking and the company substantial amounts of money
auditing functionality within the production in recent years.
pipeline, where an Oracle database keeps
track of the hundreds of thousands of Source Code Access Important
images that are created and processed for After having used Python intensively for six
each film. DCOracle2, one of the Oracle years, ILM has yet to run into significant
integration libraries available for Python, bugs or portability issues with the language.
has performed well in this task and is now As a result, since Python 1.5 ILM has been
in use on Linux, IRIX, Tru64, and Solaris. able to rely on stock distributions in
Python is also used to develop the CG unmodified form.
artist’s interface to ILM’s asset management However, availability of source code for the
system. Designed to be modular, this tool language acts as an important insurance
has been enhanced by a large group of policy should problems arise in the future,
developers and non-developers alike to or should custom extensions or improve-
extend well beyond its original mandate. ments become necessary. Without this,
The application is now used not only to ILM could never have bought into
manage CG assets and elements, but also in Python so heavily for its mission-critical
daily shot review, as a network-based white- production process.
board, as an instant messenger, and even One case where access to source has already
allows an occasional game of chess. been beneficial was in ILM’s continued use
As Python was applied in more ways, it of Python 1.4, which is generally considered
slowly crowded out a plethora of competing obsolete. Because the production facility is
technologies for shell scripting and batch under continuous use, upgrading systems to
control, embedded scripting, component new Python versions would result in signif-
software development, database application icant disruption of the production process.
development, and so forth. Python’s versa- Instead, ILM installs new systems with
tility ultimately simplified the developers’ newer versions of Python but maintains
toolset and reduced the number of tech- older systems only so they can run the same
nologies that needed to be deployed to scripts as the newer systems. Supporting
ILM’s thousands of production computers. this mix has required access to the Python
This new, simpler toolset translated directly sources in order to back-port some changes
into an easier to manage and more reliable found in newer Python versions, and to
development and production process. reimplement portions of newer support
Hardware Costs Reduced libraries under older versions of Python.
Although chosen initially for its ease of use ILM is currently running a mix of Python
and integration capabilities, Python’s porta- 1.4, 1.5, and 2.1.
bility to many other operating systems
eventually became one of its key strengths.
4
Python Tested by Time
The visual effects industry is intensely
competitive. To stay on top of the heap,
ILM continuously reviews its production
methods and evaluates new technologies
as they become available.
Since its adoption in 1996, the use of
Python has also been reviewed numerous
times. Each time, ILM failed to find a more
compelling solution. Python’s unique mix
of simplicity and power continues to be the
best available choice for controlling ILM’s
complex and changing computing environment.
5
XIST: An XML Transformation
Engine Written in Python
Dr. Walter Dörwald and Dr. Alois Kastner-Maresch
6
Instead of writing macros in hsc, we could is now used in all of our web projects at
write XML that could be processed through LivingLogic AG.
a simple mapping from XML element types Content Management with Python and JSP
to Python classes.
On top of XIST, LivingLogic has developed
In this approach, XIST generates an a content management system called
extended Document Object Model (DOM) XIST4C (4C means Content, Community,
on parsing each XML file. Classes defined Collaboration and Commerce). This system
for each element in the file are instantiated combines the advantages of XIST's
as the DOM is generated, and methods on abstracted page layouts with pre-compi-
the classes are used to perform the necessary lation of page templates to Java Server
XML transformations during page gener- Pages that are ultimately used to deliver
ation. This allows us to realize our web the content to the web.
templates with the full power of an
object-oriented scripting language. By using XIST tag libraries instead of JSP
tag libraries we are able to build optimized
During implementation, we found that all Java Server Pages that run considerably
of the key features of hsc could be supported faster than their JSP tag library counter-
quite easily in Python: parts, without any changes to the JSP files.
• Automatically calculate image sizes? This performance gain is a result of the fact
The Python Imaging Library does this that the XIST preprocessor takes care of
with ease. many compute-intensive operations, that
• Parse XML files? There are several XML might require dynamic type introspection,
parsers available in Python. string processing etc. and would be
executed by the Java tag library code
• Load and store XML to and from
during page load.
databases? The Python DB-API is
standardized and modules exist for Fast development combined with low
MySQL, Postgres, Interbase, Oracle, hardware requirements make XIST4C
ODBC, Sybase, and others. especially suitable for small and medium-
sized enterprises. This has allowed us to
• Fetch XML from the web? Python’s
achieve a unique competitive advantage,
urlparse and urllib standard libraries were
and to realize projects at a much lower cost.
made for that. Handle Unicode? Python
2.0 fully supports Unicode out of the box. Prototyping Java Systems with Python
The approach of using Python early in • Extensive and easy to use introspection
prototyping made it possible for us to study facilities make Python easy to learn inter-
concepts using working code almost from actively by discovering its capabilities,
the start of this project. Although we had including documentation, from the
to rewrite our Python prototype in Java, the command prompt.
overall time spent on prototyping was lower • Python is readily extensible in C or C++,
than we have seen in other projects that so it is easy to incorporate non-Python
used only Java. modules into an application.
Conclusion Python has played an important role in
Python is easy to learn and use, produces the success of LivingLogic AG, and will
maintainable code, and packs enough continue to be the basis for most of our
power to make it a suitable choice for many software development efforts.
application domains and project sizes.
Some of the features that we like best
about Python include:
• Python’s extensive standard library and a
considerable range of available third party
packages support development in many
application domains.
• An unsurprising syntax and the
widespread and consistent use of a
few basic concepts, like namespaces,
help to make Python code readable
and maintainable.
8
Python is Rackspace’s CORE Technology
Nick Borko
9
Python is Rackspace’s CORE Technology, continued
10
achieved our original goal of Core Objects parser pre-compiles and caches the Python
Reused Everywhere. Programmers servlet code that it produces, the CGI
throughout the company began to use this solution is sufficient for our needs. It also
API to implement interfaces to application allows us to resolve issues such as database
functionality. This required little interaction connection pooling and restricting the
with our API development team, and it could execution environment outside of Python.
be done without fear of misusing the API. Unit Testing
While we designed the API primarily for Thanks to the unit testing module that
CORE, the central enterprise application, it comes with Python, our projects are
is reused in a number of other systems at reaching production with far fewer bugs
Rackspace. For example, one group built a than we had ever thought possible when
SOAP server on top of the API, in order to we were using PHP. During maintenance
access it from their PHP applications. Other with PHP, there was always a question of
applications use the API directly, and it has been whether a change in one place would break
extremely gratifying to see our work reused and something else in another part of
integrated so easily with other systems. the application.
Integrating Python with Apache
We now write unit tests for each and
With the API in place, our next task in every API as the API is being designed.
developing CORE was to find a useful This means that we can verify the changes
templating module to integrate our Python in one module as well as its effects on all
code with HTML pages running on the the others simply by running the unit tests
Apache web server. for the entire API.
After looking at a number of available Since introducing Python and unit testing,
Python-based templating modules, we opted the nature of the bugs that we see in
to create a simple parser of our own. Our deployed applications has shifted to include
approach was to convert server-side template primarily those in the user interface, such as
pages into Python servlets whose output is layout problems or faulty event handling.
sent by the HTTP server to the user’s browser. These days, very few bugs come from the
Although this was a fairly simple exercise, API itself, and even those are generally the
we did run into some problems stemming result of poor revision management or DBA
from our design of the CORE database coordination during application
meta-class. We found that altering classes deployment. Python can’t solve _all_
and modules at runtime, as is done by the problems during development, but it
meta-class, violates guidelines imposed by certainly has reduced the number of critical
Python’s optional restricted execution system defects for us.
environment. Since we felt that restricted
Documentation
execution was a necessary component in
supporting a persistent web module, we opted Lack of documentation has been a major
to deploy CORE using CGIs rather than problem with our previous development
mod_python or similar persistent solutions. efforts. We tried several tools and policies
to document our PHP efforts, but in the end
Since fast hardware and multiple servers are
these failed. Code changed too quickly, and
readily available, and since our template
the code-level documentation tools available
11
Python is Rackspace’s CORE Technology, continued
12
Putting Web Services to Work with Python
Dr. Tim Couper, Marc-Andre Lemburg,
and Siena Technology Ltd.
13
Putting Web Services to Work with Python, continued
needed was a stable and robust server the new technique. Just as service writers
implementation and a flexible way to write shouldn’t need to think about low-level
and publish Web Services. Fortunately, the database connectivity, we felt that client
server had already been written in the form application programmers shouldn’t be
of the easily extensible eGenix.com bothered with the details of setting up
Application Server, so our task was simply connections and talking to the server side.
one of adapting this server to make writing We wanted to design a very simple appli-
services as easy as possible. cation programmer’s interface (API) which
Keep IT Simple, But No Simpler
would hide all the complications inherent
to networked client/server interaction.
Following the Python paradigm of “obvious
is better than obscure, explicit is better than Client side agents for Java® and Windows’
implicit,” we chose the most straight- COM interface made this possible by enabling
forward possible way of dealing with Web access to the Web Services from all major
Services: Each service was mapped to a client application environments such as
Python class, which provided the public Visual Basic (VB), Visual Basic for
methods to call from the client application. Applications (VBA as used in Word, Excel,
There were two reasons that we felt that and Access), Delphi, C++, Java, C# and
service implementations should look no others. These not only hide the protocol
different than any standard class implemen- level from the application programmer,
tation in Python: (1) a programmer should but also provide the key to enabling
not need to learn a new way of coding just security and fail-over solutions.
to be able to write services, and (2) existing Web Services standards are still in the
integrated development environments planning stage, and it is not at all clear
(IDEs) should be used to make coding which of the proposals will be accepted
services even easier. by standards organizations. By creating a
Since Python is an object-oriented true middle tier, we were able to hide the
programming (OOP) language in all particular methods and protocols we chose
respects, the implementation we chose inside of the Siena client and server, and
placed basic shared functionality into a were free to use existing security standards
Service base class that hides networked and authentication modes to build a secure
server interaction from the programmer. communication channel.
As a result, the service developer only Above and Beyond Web Services
needs to think about the business logic With these basic building blocks, we were
in the service methods and can rely on the moving towards realizing the Siena Web
server to automatically provide database Services Architecture, which included a
connection pooling, protocol handling, Python-based server side, a COM client
transaction control, and all the complicated side agent (also written in Python), and
interactions that are needed to make a a Java client side agent.
server side implementation robust.
One distinct advantage of writing both the
Client-side Bliss server side and COM client side of our Web
Another design goal for the system was to Services architecture in Python was that we
simplify client-side programming as much could automatically replicate services from
as possible, in order to make it easy to adopt the server to the client side. This was
14
possible whenever a service did not development possible. And IT management
depend on database connectivity or other was excited to see the overall high
elements specific to the server-side performance of our solution.
environment. Python’s data packaging The Siena Web Services Architecture has
facilities and portable byte code format become a crucial mission-critical component
made this operation quite easy to for this customer, as it moves from a two-
implement. The result was a significant tier to three-tier architecture and adds
boost in application performance, reduced fail-over and security to their Web Services.
network bandwidth requirements, reduced
network latency, and increased server The Siena Web Services Architecture will
performance, all without sacrificing the soon become part of our product line. If
efficiency of centralized server-side you are interested in the solution, please
management that makes Web Services visit our website at www.siena-tech.com/
so attractive to IT management. or contact us directly.
PS: After several months of effort, the
The Python Mantra
J2EE team never did get their Web
Still missing in our plan were the skills Services working.
needed to code Python servers and clients.
Most of the programmers in our team knew
only a mix of Java, Visual Basic, and C++.
While the J2EE group was working on
solving J2EE problems, we invested a day
in teaching Python to the rest of the team.
Python wasted no time making its way into
the hearts and minds of these programmers.
It was a thrill to hear fellow programmers
chiming in with our own Python mantra:
“This is what I’ve always been looking for.”
Results
Happy programmers are good programmers,
and good programmers work efficiently.
That’s what project management learned
at this point in our effort. The group’s Web
Services programmers quickly caught on to
the new Python-based system and devel-
opment progressed at amazing speed.
Services could now be implemented in a
few minutes rather than the days needed
using the typical J2EE approach. Now most
services were completed and deployed in
less than a day, and the ease and speed with
which they can be modified and tested has
made an incremental approach to service
15
Python Streamlines
Space Shuttle Mission Design
Daniel G. Shafer
16
the first time because postponing these The result? “We achieve immediate
activities to the end of the process means functioning code so much faster in
a loss of scheduling elasticity. Python than in any other language that
“The obvious answer,” according to Friedrich, it’s staggering,” says Friedrich. “Java and
“was to create a central database repository C++, for example, have much more baggage
to help guarantee consistency and to provide you have to understand just to get a
historical tracking of data changes.” An functioning piece of software.
Oracle database was designed to store the “Python also shines when it comes to code
information, but a graphical front end to maintenance,” according to Friedrich.
manage the process of workflow automation “Without a lot of documentation, it is hard
was clearly an essential component of an to grasp what is going on in Java and C++
effective solution. “We knew from experience— programs, and even with a lot of documen-
we do a good bit of Java coding in our tation, Perl is just hard to read and maintain.”
group–that using C++ or Java would have Before adopting Python, Friedrich’s team
added to the problem, not the solution,” was doing a good bit of Perl scripting and
Friedrich maintains. C++ coding. “Python’s ease of maintenance
Python a Mainstay Since 1994
is a huge deal for any company that has any
significant amount of staff turnover at all,”
Enter Python. “I literally stumbled across says Friedrich.
Python as I was searching the pre-Web
Gopher FTP space for some help with a The team had already developed a moder-
C++ project we were doing,” says Friedrich. ately large number of C++ libraries. Because
Being an inveterate systems engineer, of Python’s easy interface to the outside
Friedrich “just had to investigate it.” He world, USA was able to retain these
was stunned by what he discovered. libraries. “We wrote a grammar-based tool
that automatically interfaced all of our C++
“Twenty minutes after my first encounter libraries,” says Friedrich.
with Python, I had downloaded it, compiled
it, and installed it on my SPARCstation. It Another aspect of Python that Friedrich
actually worked out of the box!” found eminently significant is its shallow
learning curve. “We are always under the
As if that weren’t enough, further investi- gun on software projects, like everyone
gation revealed that Python has a number else,” he says. “But for any programmer,
of strengths, not the least of which is the picking up Python is a one-week deal
fact that “things just work the first time. because things just behave as you expect
No other language exhibits that trait like them to, so there’s less chasing your tail and
Python,” says Friedrich. far more productivity.” He contrasts that
He attributes this characteristic to three with C++ and Java, which he says takes a
primary language features: good programmer weeks to grasp and
• Dynamic typing months to become proficient.
• Pseudocode-like syntax Friedrich says that even the non-
• The Python interpreter programming engineers at USA learned to
do Python coding quickly. “We wanted to
17
Python Streamlines Space Shuttle Mission Design, continued
draft the coding energy of the engineering At the core of the design is the Task object,
staff, but we didn’t want them to have to which stores all information relevant to a
learn C++. Python made the perfect 4GL single task in the workflow network. The
programming layer for the existing C++ end user can view the network in a PERT-
classes.” style chart layout, where color coding
One Coder and 17,000 Lines of Code Later
reveals at a glance which tasks are finished,
which are in process, and which have not
The WAS project, which has required some- yet been started.
what less than a man-year of effort, has been
coded by a single senior software engineer, Two other graphical interface windows
Charlie Fly, who has cranked out some 17,000 allow the user to manage the dependencies
source lines of code (SLOC). Python plays among data items in the network and to
the central role, managing data interactions view and edit individual task details.
and the task network. All of the code for the UIs was also done
In the system, user tasks communicate with in Python, using the popular Tkinter library
a Python data server, which in turn connects along with an open source package of
to an Oracle server via DCOracle. Using supporting modules. Tkinter is included
Oracle’s built-in trigger mechanism to send in all standard Python installations.
a message to WAS as data records are “USA is pleasantly surprised by how much
updated, the WAS calculates which tasks quality software we can deliver,” Friedrich
are now data-ready and notifies the says. “And each time we demonstrate
appropriate user. success with Python, we add a few more
believers to my growing list!”
18
Wing IDE Takes Flight with Python
Stephan R.A. Deibel and John P. Ehresman
19
Wing IDE Takes Flight with Python, continued
writing an entire IDE wasn’t going to be cation, scalability, rock-solid stability, and
easy and wanted to be sure that Python its strong support for mixed-language
was really as good as it appeared to us at development.
the time. The logical way to approach this Productivity
was to develop the IDE itself in Python.
This would give us proof of concept and Over the course of this project, we have
let us become early users as we started to been able to write on average over 175
develop and debug Wing IDE with itself. lines of debugged, documented, tested
code per developer per day. Over a period
To speed development and keep costs of 660 FTE days, we produced a total of
down, we chose to base Wing on as many approximately 121K lines, of which 77K
open source modules as we could find. were written in Python. Even without
The GUI was written with GTK, which considering that a line of Python is typically
is accessed from Python via PyGTK. The equivalent to ten or more lines of C, we
source editor is based on Scintilla, an were extremely pleased with this result.
open source code editor component.
And printing is implemented via The entire product, including third-party
py2pdf from ReportLab. open source modules, actually contains
on the order of 1.2 million lines of code,
Initial development was on Linux but of which 274K lines are Python.
we planned to support at least Windows
and eventually other Unix-like operating So why was using Python so productive,
systems. For this reason, we avoided even when only 63% of the code we wrote
platform-specific implementations and was in Python? There are several answers
chose cross-platform technologies. to this question:
21
Wing IDE Takes Flight with Python, continued
In the course of development and in these results confirm without any doubt
responding to thousands of support tickets that working in Python is far more
over a three year period, we have never run productive than working in C or C++.
into any significant problems with Python In hindsight, we believe that we could
itself, either in scalability or stability. Wing have converted smaller units of code into
IDE can handle software projects with C, by writing more general data-driven
thousands of Python files, and in many processing engines and by more carefully
cases can run for weeks without problems. selecting code to convert instead of
To our knowledge, we have yet to see Wing converting whole modules at a time. Our
IDE crash because of a flaw in the Python primary goal for Python in the future is to
interpreter or its standard libraries. be able to use it more often, even in
Mixed-language Development performance-critical sections of code.
Python is almost always fast enough but This effort should benefit from projects
we did run into a few cases where the like pyrex, which allows the use of Python-
interpreter introduced too much over- like code in the development of compiled
head. The Wing IDE debugger and extension modules, and psyco, which is a
the source code analysis engine both just-in-time compiler for Python.
contain modules that engage in extremely Quirks
CPU-intensive processing. These modules There are just two quirks that affected our
needed to be written in C in order to development with Python. The relative
squeeze out as much speed as possible. impact they had on our project was tiny
Fortunately, Python is designed to make it compared to Python’s benefits, but for
quite easy to call back and forth between balance we feel they are worth mentioning:
Python and C or C++.
1) Like Java and other languages, Python
In most cases, we wrote and debugged occasionally deprecates old features, or
code first in Python, and then converted fixes minor bugs in a way that can poten-
by hand into C. This approach worked tially break existing code. This is done over
well for us. Working initially in Python the course of a number of releases, so that
was much more efficient and the programmers will first see deprecation
conversion process relatively painless. warnings, and only later be impacted by
Analysis of our records shows that 360 the change. We ran into this only once
days were spent on 77K lines of Python when Python 2.0 began to disallow
code and 300 days (almost as much) on multiple arguments to the sequence append
44K of C, C++, or other code. From our method. This problem required changing
experience with code conversions, we exactly three easily found calls in our code
believe it is roughly correct for most types base of over 77K lines of Python.
of performance-critical code to equate one
line of Python with ten lines of C or C++ 2) Different versions of Python can produce
code. This means that about 5-10% of our incompatible compiled byte code and
application functionality is in C or C++ requires that C/C++ extension modules
and the rest is in Python. Even considering are compiled against a specific version of
that the C/C++ code is somewhat more Python. For example, while Python 2.2.2
complex than most of the Python code,
22
works happily with Python 2.2.1 or 2.2.0 Conclusion
byte code and extension modules, it will Without Python, we could not have sustained
print warnings and may run into problems the Wing IDE development effort long
running against those compiled against enough to produce what is now a successful
Python 2.1.x or earlier. There are solid software product. Python has been more
technical reasons behind this design productive, robust, and portable than any
choice, but it does require some additional other technology we have tried. Through
work when packaging applications for our experiences providing technical support
distribution to users running different for the IDE, we know that we are not alone
versions of Python. In the Wing IDE in these assessments. Feedback from our
debugger, we solve the problem simply customers often includes strong endorse-
by storing separate directories for each ments for the productivity of Python, Wing
interpreter version and importing modules IDE, and related technologies such as Zope.
accordingly at runtime. For the IDE itself,
we solve it by shipping with a specific
Python interpreter included; a task that’s
easily accomplished with support found
in the Python standard library’s
distutils package.
No other language we have used has been
this devoid of quirks, even those we have
used much less intensively and across fewer
language revisions.
23
Python Enterprise-Wide at the
University of St Andrews in Scotland
Hamish Lawson
One of our earliest Python projects was a Because of the number of concurrent users
facility for university job vacancies. This that the system was expected to support,
was implemented using Zope, an innovative particularly during matriculation, we felt
Python-based web application server that that a traditional CGI approach could lead
provides a range of web components plus to performance problems. Instead, we
powerful facilities for templating and employed mod_scgi, an Apache module
integration. I started the project with a that implements the client end of the SCGI
colleague who had more experience in web protocol for long-running web processes
design than programming. After some time, (similar to FastCGI). The server end of
we found that Python’s powerful simplicity the SCGI protocol was implemented by
enabled my colleague to improve his Quixote, a Python-based web framework.
programming skills rapidly, to the point Quixote also provided a URL mapping
where he was able to continue development mechanism that simplified the job of
of the system by himself. Zope itself also publishing objects on the web. Cheetah
helped in this regard, by reducing the was again used for handling presentation,
amount of programming that needed to and Oracle was used for storage.
be done in the first place. We were assigned this project somewhat late
in the process, and it was clear that it would
Student Record System
come into active use while parts of it were
One of our larger projects was a system still being developed. To support this, we
for managing student records. It employs a planned to deliver the system in stages, but
model-view-controller architecture in order we were aware from the outset that many of
to promote reuse. Presentation is handled the system requirements still had to be
by Cheetah, an open-source templating discovered and understood. We knew this
technology for Python. The interface would lead us to rewrite parts of the system
between Python and the underlying Oracle® as we went along and worked to obviate
database is handled by the high-quality this with design decisions aimed at decou-
DCOracle2 driver made freely available pling the system’s components. Python’s
by Zope Corporation. dynamic nature and supreme flexibility
Matching Students with Classes made it easier to write generic interfaces,
Python was also used for a web-based which later facilitated the rewriting and
system that managed the process of refactoring tasks we had to undertake.
matching students with the classes they Conclusion
wished to take in the coming year. The Since switching to Python, we are writing
system was used by most of our students better structured and more readable code
and a number of our staff for various stages in less time ... and it’s fun! I can’t think of
of the process–from selecting preferences a better testament to a programming tool.
25
Python Powers Journyx Timesheet
Curt Finch and John Maddalozzo
Pythonology
http://pythonology.org
Python Starship
http://starship.python.net
Daily Python-URL
http://www.pythonware.com/daily/index.htm
Pyzine
http://www.pyzine.com
Python Journal
http://pythonjournal.cognizor.com
http://conferences.oreilly.com/oscon
http://www.oreilly.com
Item # 30067