TechBookReport logo



Keywords: Python, scripting languages, object-oriented programming

Title: Learning Python

Authors: Mark Lutz and David Ascher

Publisher: O'Reilly

ISBN: 0596002815

Media: Book

Level: Introductory

Verdict: A great introduction to the Python language, tools and community

There's a lot of discussion about the exact definition of a 'scripting language', but in some cases there's an implied hierarchy, with 'scripting languages' lower on the scale than 'system languages' such as Java, C++ or C#. In the case of Python to dismiss it in this way is to miss the point. Python is a powerful object-oriented programming language in its own right. Python, like Perl, straddles that grey area between scripting and application building. How else can you describe a dynamically-typed, object-oriented interpreted language?

All of this is a roundabout way of introducing 'Learning Python', by Mark Lutz and David Ascher, and published by O'Reilly. Aimed at Python beginners, this is a comprehensive and detailed introduction to the language, the tools and the community that surrounds it.

The first part of the book opens with some 'getting started' chapters. These cover an introduction to the history of Python, some discussion of what you can and can't do with it, a look at the interpreter, some stuff on IDEs (including IDLE and PythonWin), and so on. This is enough to whet the appetite, set the context and equip the reader with enough tools and information to get started.

Part two moves on to looking at the different data types: numbers, strings, lists, dictionaries, tuples and files. These are the data building blocks that the Python programmer has to play with. The authors do a good job of explaining how powerful these data types are, particularly lists and dictionaries. Standard abstract data types, such as stacks or queues, are shown to be trivial to implement.

Having mastered the data types the following section looks at Python statements and syntax, including more on assignment, tests for equality and the basic conditional tests and loops.

This is followed by part four, which looks at Functions. This includes a chapter on more advanced topics, including functional programming with lambda functions, list comprehensions, generators and iterators and more. This stuff is amazingly powerful and it's worth the effort to understand how they work and what they get you. Anyone who scoffs at 'scripting languages' really ought to take a look at what Python is able to accomplish in just a few lines of code using this kind of stuff.

Parts five and six look at modules and object-orientation. Even if you are familiar with object oriented programming it makes sense to study this stuff because there are clear differences between how Python implements this and other languages like Java or C#. For a start information hiding using private methods or fields in a class do not apply in Python. However the authors explain the differences very clearly, just as they explain the benefits of objects for those readers with no previous experience of object-oriented programming.

The last part of the book to focus on core language issues looks at Exceptions and exception handling.

The final section of the book is entitled 'Outer Layers' and looks in more detail at solving common programming problems in Python, at frameworks and resources. These three chapters are not just froth to pad the content, they provide some useful material to take the reader beyond the focus on language and syntax. The chapter on frameworks is especially interesting, it covers interfacing with COM object in Windows, creating a GUI using Tkinter and introduces the Jython implementation of Python (i.e. the union of Python and Java).

The book does a great job of inspiring the reader. By the end of the book the reader is going to be itching to get there hands on a real problem to solve using the skills they would have picked up here. For the Python beginner this is a great place to start.


Hit the 'back' key in your browser to return to subject index page

Return to home page