Python Annotated Archives


This book is intended to be a guide to scripting with the Python language. It is not, however, a complete guide to the Python language, nor is it an attempt to demonstrate the only way to achieve a particular result in Python. Instead, this book aims to demonstrate ways of using Python in real world situations. I show you real world scripts and annotate them to describe both the logic being used and the Python-specific features being employed to achieve a goal.About PythonPython is an interpreted language that employs an object-oriented approach. It’s a high-level programming language, which means that it separates the user from the underlying operating system as much as possible. However, unlike other languages, Python provides you with the ability to access the OS at a lower level if you desire. Because of this ability, Python is often pitched somewhere between such languages as Visual Basic and Perl and the system language of C.Although it is classed as an interpreted language, like Perl it employs a compilation stage that translates the raw Python script into a series of byte codes, which are then executed. These byte codes can be saved into a new file to enable faster execution of Python problems. The use of the compilation and byte code stages helps to improve performance and makes Python much faster than pure interpreters.Python also has the added benefit of providing rapid application development on the MacOS, Windows (95/98/NT), and Unix platforms. Python is supplied with a module to the Tk interface builder, and it’s possible to write an application on one platform and use it on all three platforms without making any modifications. In addition to the core platforms, Python also runs on MS-DOS, Amiga, BeOS, OS/2, VMS, QNX, and many more operating systems.Python has been around for many years now and has a strong following from a number of well-known companies for many different purposes. These companies include NASA, which uses it for their Integrated Planning System; Infoseek, which sells a Python-based search engine product called Ultraseek Server; and Red Hat, which uses it in their Linux product for configuration and administration tasks.One final note for those wondering what “Python” stands for: basically it doesn’t. Guido van Rossum selected the word because he is a big fan of Monty Python, a popular comedy group consisting of the talents of John Cleese, Eric Idle, Michael Palin, Terry Jones, Terry Gilliam, and Graham Chapman. Although I will admit to also being a huge fan of Monty Python, this connection has in no way influenced my love of Python. Well, not much…Who This Book Is ForUnlike many other programming books, this title is not designed to be a reference or language guide, nor is it targeted at a particular set of users. If you program in Python, or think you might like to program in Python, you should find this book useful.If you’re evaluating or just starting to learn Python, this book provides you with some examples and guidance on how to make the best use of Python and what it can be used for. All of the scripts in the book work straight off of the page (or the supplied CD-ROM) and demonstrate the range of features and abilities of the Python language.If you’re an intermediate programmer, this book helps to serve as a guide for improving your programming skills. It also provides a wider view of the available modules and extensions for the Python language and how they can be employed in your current development projects.If you’re a more advanced programmer, the scripts contained in the book can help augment or form the core of Python development efforts. They might even provide you with examples and ideas for using Python that you hadn’t before considered.In all cases, and for all programmers, the scripts provided here are intended to demonstrate the different features of the Python language and the ways in which you can use different methods to achieve the same or a similar result. All of the scripts can be taken from the supplied CD-ROM and used on your machine. You may have to account for minor differences, such as filenames and locations, but otherwise the scripts should work unmodified. If not, please let me know.