About This Second Edition

In the four years after the first edition of this book was published in late 1998, there have been substantial changes in both the Python language and in the topics presented by the authors in Python training sessions. Although we have attempted to retain as much of the original version as possible, this new edition reflects recent changes in both Python and Python training.

On the language front, this edition has been thoroughly updated to reflect Python 2.2, and all changes to the language since publication of the first edition. In addition, discussion of anticipated changes in the upcoming 2.3 release have been incorporated throughout. Some of the major language topics for which you'll find new or expanded coverage in this edition are:

  • List comprehension (Chapter 14)

  • Class exceptions (Chapter 25)

  • String methods (Chapter 5)

  • Augmented assignment (Chapter 8)

  • Classic, true, and floor division (Chapter 4)

  • Package imports (Chapter 17)

  • Nested function scopes (Chapter 13)

  • Generators and iterators (Chapter 14)

  • Unicode strings (Chapter 5)

  • Subclass types (Chapter 7 and Chapter 23)

  • Static and class methods (Chapter 23)

  • Pseudo-private class attributes (Chapter 23)

  • Extended print and import statements (Chapter 8 and Chapter 18)

  • New built-ins such as zip and isinstance (Chapter 7 and Chapter 10)

  • New-style classes (Chapter 23)

  • New configuration and launch options, and .pth files (Chapter 3 and Appendix A)

  • New development tools such as IDLE, Psyco, Py2exe, and Installer (Chapter 2, Chapter 3, and Chapter 29)

  • New testing and documentation tools such as PyDoc, PyUnit, and doctest (Chapter 11)

Smaller language changes (e.g., long integer promotion, module export lists) appear throughout the book. Besides such language changes, we augmented the core language parts of this edition (Part I-Part VII) with new topics and examples presented in the Python training sessions Mark has held in recent years. For example, you'll find:

  • A new OOP introduction (Chapter 19)

  • A new dynamic typing overview (Chapter 4)

  • A new development tools summary (Chapter 26)

  • New material on program architecture and execution (Chapter 2, Chapter 3, and Chapter 15)

  • New coverage of documentation sources (Chapter 11)

Many core language part additions and changes were made with beginners in mind. You'll also find that the coverage of many original core language topics has been substantially expanded in this edition, with new discussion and examples. Because this text has largely become the primary resource for learning the core Python language, we've taken liberties with making that coverage more complete than before, and added new use cases throughout. Likewise, we updated Part VIII to reflect recent Python application domains, and modern usage patterns.

In addition, this entire edition integrates a new set of Python tips and tricks, gleaned from both teaching classes over the last seven years, and using Python for real work over the last decade. The exercises have been updated and expanded to reflect current Python practice, new language features, and common beginner mistakes we've witnessed first-hand in recent years. Overall, this edition is bigger, both because Python is bigger, and because we've added context that has proved to be important in practice.

To accommodate the fact that this edition is more complete, we've split most of the original chapters into bite-sized chunks. That is, we've reorganized the core language section into many multichapter parts, to make the material easier to tackle. Types and statements, for instance, are now two top-level parts, with one chapter for each major type and statement topic. This new structure is designed to allow us to say more, without intimidating readers. In the process, exercises and gotchas were moved from chapter ends to part ends; they now appear at the end of the last chapter in each part.

Despite all the new topics, this book is still oriented toward Python newcomers, and is designed to be a first Python text for programmers.[1] It retains much of the first edition's material, structure, and focus. Where appropriate, we have expanded introductions for newcomers, and isolated the more advanced new topics from the main thread of discussion to avoid obscuring the fundamentals. Moreover, because it is largely based on time-tested training experience and materials, this edition, like the first, can still serve as a self-paced introductory Python class.

[1] And by "programmer," we mean anyone who has written a single line of code in any programming or scripting language in the past. If you don't meet this test, you will probably find this book useful anyhow. But we'll spend more time teaching Python than programming fundamentals.



Learning Python
Learning Python: Powerful Object-Oriented Programming
ISBN: 0596158068
EAN: 2147483647
Year: 2003
Pages: 253
Authors: Mark Lutz

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net