Python by Examples
A Hitchiker's Guide to Learning Python in Python
Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code.
When I first started studying Python, I had a problem: it felt like every piece of documentation or tutorial available was very redundant. Granted, there were lots of documentation available for just about any topic imaginable, but it felt like I had to read two pages to understand something that could be explained in 10 lines of code. I felt bored. Maybe because tutorials in general are meant for people that have little background in programming ? Don't know. Don't care either. =)
The code is the documentation.
This tutorial is an effort to create the kind of tutorial that I wanted but couldn't find: a concise, comprehensive and direct Python tutorial by examples, specially written for developers. In reading this document, I'm assuming that you already have some good experience with another programming language and is able to understand a self-explanatory source code, either through The Force (tm) or by logical deduction. I also assume that you know the basics on how interpreted languages work, memory management, operating systems (UN*X systems), threads/concurrency, OOP, network programming, etc. Aside from examples, I may also write a small introduction about some module or function, if I see fit.
Ultimately, it never hurts to read the official documentation, specially the standard library reference. Even if you cannot remember by heart every single function and their arguments, at least you will know when a function to do something you want already exists… so give it a shot! The official documentation can be found on http://www.python.org/doc/ (you may want to download the PDF versions so you can have it always handy. Or not.)
All source code on this tutorial was successfully tested on Python 2.5.2 (the latest version available at the moment of this writing (2008-02-26)).





