If youre standing in a bookstore looking for the short story on this book, try this:
This Books Ecosystem
Python is a popular open source programming language used for both standalone programs and scripting applications in a wide variety of domains. It is free, portable, powerful, and is both relatively easy and remarkably fun to use. Programmers from every corner of the software industry have found Pythons focus on developer productivity and software quality to be a strategic advantage in projects both large and small.
Whether you are new to programming or are a professional developer, this book is designed to bring you up to speed on the Python language in ways that more limited approaches cannot. After reading this book, you should know enough about Python to apply it in whatever application domains you choose to explore.
By design, this book is a tutorial that emphasizes the core Python language itself, rather than specific applications of it. As such, this book is intended to serve as the first in a two-volume set:
Learning Python, this book, teaches Python itself, focusing on language fundamentals that span domains.
Programming Python, among others, moves on to show what you can do with Python after youve learned it.
This division of labor is deliberate. While application goals can vary per reader, the need for useful language fundamentals coverage does not. Applications-focused books such as Programming Python pick up where this book leaves off, using realistically scaled examples to explore Pythons role in common domains such as the Web, GUIs, systems, databases, and text. In addition, the book Python Pocket Reference provides reference materials not included here, and it is designed to supplement this book.
Because of this books focus on foundations, though, it is able to present Python language fundamentals with more depth than many programmers see when first learning the language. Its bottom-up approach and self-contained didactic examples are designed to teach readers the entire language one step at a time.
The core language skills youll gain in the process will apply to every Python software system youll encounterbe it todays popular tools such as Django, NumPy, and App Engine, or others that may be a part of both Pythons future and your programming career.
Because its based upon a three-day Python training class with quizzes and exercises throughout, this book also serves as a self-paced introduction to the language. Although its format lacks the live interaction of a class, it compensates in the extra depth and flexibility that only a book can provide. Though there are many ways to use this book, linear readers will find it roughly equivalent to a semester-long Python class.
About This Fifth Edition
The prior fourth edition of this book published in 2009 covered Python versions 2.6 and 3.0.[] It addressed the many and sometimes incompatible changes introduced in the Python 3.X line in general. It also introduced a new OOP tutorial, and new chapters on advanced topics such as Unicode text, decorators, and metaclasses, derived from both the live classes I teach and evolution in Python best practice.
This fifth edition completed in 2013 is a revision of the prior, updated to cover both Python 3.3 and 2.7 , the current latest releases in the 3.X and 2.X lines. It incorporates all language changes introduced in each line since the prior edition was published, and has been polished throughout to update and sharpen its presentation. Specifically:
Python 2.X coverage here has been updated to include features such as dictionary and set comprehensions that were formerly for 3.X only, but have been back-ported for use in 2.7.
Python 3.X coverage has been augmented for new yield
and raise
syntax; the __pycache__ bytecode model; 3.3 namespace packages; PyDocs all-browser mode; Unicode literal and storage changes; and the new Windows launcher shipped with 3.3.
Assorted new or expanded coverage for JSON, timeit
, PyPy, os.popen
, generators, recursion, weak references, __mro__
, __iter__
, super
, __slots__
, metaclasses, descriptors, random
, Sphinx, and more has been added, along with a general increase in 2.X compatibility in both examples and narrative.
This edition also adds a new conclusion as for a concise summary of Python changes between the prior edition and this one, as well as links to their coverage in the book. This appendix also summarizes initial differences between 2.X and 3.X in general that were first addressed in the prior edition, though some, such as new-style classes, span versions and simply become mandated in 3.X (more on what the Xs mean in a moment).
Per the last bullet in the preceding list, this edition has also experienced some growth because it gives fuller coverage to more