Full Monte - Python
In aclassic sketch from the British comedy troupe Monty Python, one member sauntersinto a restaurant for some breakfast. As the waitress recites the menu, thepatron quickly realizes that no matter what he chooses, he’s stuck with atleast one side dish he’s not keen on. “Eggs and Spam; eggs, bacon, and Spam;Spam sausage; Spam, Spam, bacon, Spam, tomato, and Spam…,” spouts the waitress.As the customer’s face falls, an inexplicable group of Viking diners begin torhythmically chant “Spam… Spam… Spam….”
Similarly,when choosing a programming language one typically gets a side dish he or shemay not enjoy.
With C++you get stuck with an extremely complex language. Choose Java and you get aside of multiple Java VM implementations and Sun’s poor attitude towardstandards. The tasty Visual Basic comes with a single-platform dish with adubious architecture. Perl brings a dollop of bizarre syntax. Even C#, the newclean-slate language from Microsoft, is saddled with an appetizer of politicsand uncertain industry support. Out of the mix of available languages comes onepowerful, simple, and free language that sticks to the main course: Python.
Python,named after Monty Python and not after the reptile, is the ongoing open-sourcecreation of Guido van Rossum. Python is an interpreted, object-orientedlanguage with a portable run-time that works on dozens of platforms. Thestandard Python distribution includes an interactive integrated developmentenvironment that makes experimenting and learning about object-orienttechniques as easy as any environment I know. And while copyrighted, Python maybe distributed and integrated into real commercial products for the low, lowprice of nada.
Simple but Powerful
The firstthing you’ll notice as you peruse Python code is that it is always formattednicely. That’s because indentation determines where a code block starts and ends.Unlike most other languages, Python won't let you create code that appearscorrect but actually hides bugs with misplaced semicolons, braces, and End Ifs.This common-sense approach permeates Python, yet it is still powerful. In factthe language supports user-defined classes with both polymorphism and multipleinheritance, something Java, Delphi, and C# avoided. Python’s high-level,built-in types help keep programming simpler. In addition to basic numerictypes, Python also natively supports strings, lists, tuples (immutable lists),associative arrays, and complex numbers. Support for modules deters namespacecollisions.
Is it a goer?
Does you languagego? Is it a goer? Knowwhatahmean? Wink-wink, nudge-nudge, say-no-more! Manyprogrammers are turned-off by scripting languages, regarding them as slow. Aninteresting study by Lutz Prechelt compares 80 implementations of the samerequirements in seven different languages on many different platforms. Theresults are surprising. Scripting languages -- Python in particular -- scoredvery high in code correctness and consistently bested Java in performance.That’s not to say that an expertly written C++ program won’t blow away anequivalent Python program, but it does highlight how little code today isexpertly written.
Is Python agood fit for your project? I ask of thee these questions three: What is yourbusiness? What is your quest? What is the airspeed velocity of an unladenEuropean swallow? You see, I knewPython’s complex number support would come in handy eventually. --Eric Binary Anderson has led projects at anumber of enterprise software companies and is the senior architect at IBTFinancial (Bend, Ore.), an Internet-based training company. Contact him at firstname.lastname@example.org.