Book Review - Learning Python, Second Edition

Networking/Security Forums -> News // Columns // Articles

Author: StormhawkLocation: Warwickshire, England, UK PostPosted: Tue Mar 14, 2006 5:15 pm    Post subject: Book Review - Learning Python, Second Edition
    ----
Learning Python

Author(s): Mark Lutz & David Ascher
Publisher: O'Reilly, http://www.oreilly.com/
Date Published: December 2003
Book Specifications: Softcover, 591 pages
Category: Programming / Python
Publisher's Suggested User Level: Not rated
Reviewer's Recommended User Level: Python programmers of all levels
Suggested Publisher Price: $34.95 US / $50.95 CDN
ISBN: 0-593-00281-5
Amazon.com: http://www.amazon.com/exec/obidos/ASIN/0593002815
Amazon.co.uk: http://www.amazon.co.uk/exec/obidos/ASIN/0593002815




Blurb from back cover:

Python is a popular open source, object-oriented programming language used for both standalone programs and scripting applications. Portable, powerful, and a breeze to use, there's no quicker way to master the language than to learn from expert teachers. This new edition of Learning Python puts you in the hands of Mark Lutz and David Ascher, two notable Python experts and trainers whose friendly, well-structured prose has guided many programmers to proficiency in the language.

Learning Python, Second Edition offers programmers a comprehensive learning tool for Python and object-oriented programming. Thoroughly updated for the numerous language changes since the release of the first edition in 1999, this book introduces the basic elements of the latest release of Python 2.3 and covers new features, such as list comprehensions, nested scopes, and iterators / generators.

Beyond language features, this edition of Learning Python also includes new context for less-experienced programmers, including fresh overviews of object-oriented programming and dynamic typing, new discussions of program launch and configuration options, new coverage of documentation sources, and more. There are also new use cases throughout to make the application of language features more concrete.

Learning Python starts by giving programmers all the information they'll need to understand and construct programs in the Python language, including types, operators, statements, classes, functions, modules and exceptions. The authors then present more advanced material, showing how Python performs common tasks by offering real applications and the libraries available for those applications. There are exercises throughout the book to test your new skills.

Learning Python, Second Edition, is a self-paced book that allows readers to focus on the core Python language in depth. As you work through the book, you'll gain a deep and complete understanding of the Python language that will help you to develop larger applications on your own. This book is for anyone who doesn't want to stop at just learning Python, but wants to master it as well.



Introduction

Python is rapidly becoming the language of choice for rapid development, gluing incompatible applications together, prototyping, and web services. In many situations, it can replace Perl as the "glue that binds UNIX together", and is most definitely easier to read and maintain than Perl code.

This book introduces the reader to the Python language, step by step, revealing the core functionality, the modules, and the power behind Python, in easy to understand pieces.

Python is used increasingly by large companies and applications of Python are limitless. This book is a must-have for any programmer, system administrator or web services co-ordinator.


Chapter Synopsis & Review Comments

Chapter 1 asks, and answers, a few questions about Python. This is the usual stuff you'd expect to find in any programming book, and it serves to put the reader into the picture, to show him or her where Python fits into the world, how it does so, and what they should expect to be able to do by the time they've finished the book.

The Python interpreter is covered in detail in chapter 2. Since the method of program execution determines how portable a programming language is, as well as how fast programs written in it are likely to be, this is an essential step to understanding Python itself.

Chapter 3 discusses running your own Python programs. Interactive coding and scripts are covered. This chapter goes into a lot of detail, and includes a large number of examples. It is nice to see the basics being covered in detail, setting a foundation for the language discussion to follow. This chapter also introduces the exercises which are present throughout the book, and serve to make the reader think about the topics they have just covered, and practice working in the Python environment.

Chapter 4 looks at numbers. These are essential in just about every program, and this chapter covers the built in types made available by Python, the operators and expressions which can be used to manipulate them, and even touches on operator overloading, introducing the reader to object-oriented features of programming gradually, so that when those aspects of Python are covered in full, the reader already has some idea as to how it all fits together.

Strings are covered in chapter 5. String storage, and operations on strings are both discussed, with examples and pictorial representations of the topics being discussed. The chapter remains easy to understand, even though a leap in complexity is made.

In chapter 6, the list and dictionary types available in Python are introduced for the first time. These are complex types which can require a great deal of explanation, which is precisely what is offered in this book.

Chapter 7 is aptly named "Tuples, Files, and Everything Else". This encompasses the entire object-oriented nature of Python, and introduces two important types that Python provides. Once again, these are complex types with many operations, and the explanations provided are thorough yet reassuring.

Chapter 8 gives us the tools we require to assign values to variables, and to make calculations based on these. It also introduces the print statement in its full technical glory, and is the first point in the book where real, useful, programs may be constructed.

Program logic and flow control are introduced in chapter 9 with the "if" statement. Multiple examples are given to illustrate the techniques and the Python syntax. This trend is continued into chapter 10, which covers the "for" and "while" loops.

Chapter 11 begins to look at documenting Python code, and the mechanisms for doing so provided by Python itself. The emphasis is on writing maintainable code, and documentation formats which correspond well with the productivity/maintainability balance.

Functions are introduced in chapter 12. Allowing for a modular approach to programming is a powerful part of Python, and is encompassed in the philosophy behind its standard library. Functions are the first step towards such modularity, and this chapter emphasises the importance and power of functions. Chapter 13 looks at scopes and arguments, determining in which scope a variable is visible, and also details the mechanics of passing arguments to a function in Python.

Lambda (anonymous) functions are covered in chapter 14, along with other advanced function topics. These topics are explained in context and the reader should not have a problem with understanding these topics, despite their apparent initial complexity.

Modules are discussed in detail in chapter 15. Some questions on the reasoning behind a modular system are presented, with answers, and then the chapter discusses the Python approach to modularity. Chapter 16 looks at the basics of coding, creating, and using modules.

Module packages are covered in chapter 17, which ties together the information from previous chapters to provide a glimpse into the true modular design of Python's standard library. Modularity is wrapped up with chapter 18, covering advanced topics such as data hiding and module design concepts.

Chapter 19 introduces object oriented programming. Another Q&A session ensues, which is definitely one to skip if you're already at home with OOP, but does serve as a gentle introduction to those not already familiar with the topics.

Chapter 20 discusses class coding within Python, and chapter 21 takes this further. These two chapters are written in such a way that if you understand OOP, they inform you of the Python approach without being patronising, but still introduce concepts as they go, allowing those not already familiar to gain a foothold.

Designing with Classes is the title of chapter 22. In this chapter, the use of classes and OOP within Python is discussed in detail, looking specifically at the OO techniques of inheritance, polymorphism and encapsulation. Chapter 23 extends on this by covering some advanced class topics, especially looking at changes in the latest Python versions. This information is crucial to anyone building a Python system for compatibility, but is often left out of many introductory books.

Chapter 24 covers exceptions, the error handling mechanism of Python. The basics are introduced here along with explanations of why exceptions are used. This kind of introduction draws the user in slowly but covers everything that is needed before throwing (no pun intended*) exceptions at them. Chapter 25 looks at exception objects, which combine the class topics of earlier chapters with the exception handling of chapter 24, while chapter 26 discusses program design with exception handling.

Chapter 27 takes a step away from the flow of teaching in the book to look at common tasks and how they may be achieved in Python. The standard library modules are introduced here, and illustrated in numerous examples, each with a specific task which is commonly encountered in a larger program.

Chapter 28 looks at frameworks; the first point in the book where larger, more complete Python programs are examined. This chapter really helps to pull together the different aspects of Python and bring everything into perspective.

Python Resources are covered in chapter 29. Here, the community surrounding Python is explored and useful resources for the beginner in Python programming are detailed. Many books include a chapter on further reading or additional resources, but this chapter fully embraces the Python community and the reader should get the feeling that Python is actively developed, maintained and improved, and that the same people working on that are around to help the beginner take the first steps into a world beyond the scope of this book!

Appendix A covers installation and configuration of Python itself, appendix B presents solutions to the exercises throughout the book, though I would personally recommend avoiding this chapter until you have at least attempted some or all of the exercises.

* Python uses the keyword raise to generate an exception. In some other OO languages, there is an equivalent keyword named throw. Thus, exceptions are thrown at the point where an error is detected, and caught at the point where the error is handled.

Style and Detail

As I have commented on throughout the synopsis and comments section of this review, topics are explained in detail, but at a pace which is slow enough for the beginner, but fast enough for those already experienced in similar languages, who want to pick up Python quickly for a project that may already be running late.

As expected from any O'Reilly book, the writing style is friendly and informative, authoritative without being superior. The authors explain concepts and practices thoroughly, even where there may be hidden complexities.

Learning Python is a smooth, flowing read. From start to finish, the topics follow on logically and the content is presented in discrete steps, slowly building up the whole of the core of Python.

It was nice to see the later chapters focussed on combining the content of the earlier chapters into larger, working programs. Many books use the later chapters simply to explore advanced concepts in isolation, whereas here the whole of Python is brought together, showing some of the ways the topics from earlier in the book may be combined and how everything interacts.

Conclusion

If I was asked to recommend any single book for those learning Python, this would undoubtedly be it.

Fully comprehensive as an introduction to the Python language, this book cannot be faulted.

Learning Python, Second Edition receives an honoured SFDC Rating of 10/10.



Keywords: python, learning, programming, module, modular, object oriented

This review is copyright 2006 by the author, Andrew J. Bennieston, and Security-Forums Dot Com, and may not be reproduced in any form in any media without the express permission of the author, or Security-Forums Dot Com.

Author: Carlo GambinoLocation: Ohio, USA PostPosted: Wed Feb 20, 2008 5:00 am    Post subject: Good review, Great book, even better language!
    ----
This is one of 3 books that introduced me to the wonderful workd of python. I think this review captures the spirit of the book, which certainly will toss you into learning to harness the flexibility and power of python!

From small scripts to automate small daily tasks to in-depth, complicated graphical applications, python allows you to do what you need when it's needed and in a relatively fast time compared to most other languages I've experienced.

Author: dieguinsss PostPosted: Tue Feb 24, 2009 2:10 pm    Post subject: Learning Python...
    ----
I agree with the response from Carlo.

This is one of the best books for learning Python from scratch. You must have basic knowledge of programming.

PD: Sorry for my English translation



Networking/Security Forums -> News // Columns // Articles


output generated using printer-friendly topic mod, All times are GMT + 2 Hours

Page 1 of 1

Powered by phpBB 2.0.x © 2001 phpBB Group