In general, this book has always strived to be agnostic about both Python versions and platforms. It’s designed to be useful to all Python users. Nevertheless, because Python changes over time and platforms tend to differ in pragmatic ways, I need to describe the specific systems you’ll see in action in most examples here.
This fifth edition of this book, and all the program examples in it, are based on Python versions 3.3 and 2.7. In addition, many of its examples run under prior 3.X and 2.X releases, and notes about the history of language changes in earlier versions are mixed in along the way for users of older Pythons.
Because this text focuses on the core language, however, you can be fairly sure that most of what it has to say won’t change very much in future releases of Python, as noted earlier. Most of this book applies to earlier Python versions, too, except when it does not; naturally, if you try using extensions added after a release you’re using, all bets are off. As a rule of thumb, the latest Python is the best Python if you are able to upgrade.
Because this book focuses on the core language, most of it also applies to both Jython and IronPython, the Java- and .NET-based Python language implementations, as well as other Python implementations such as Stackless and PyPy (described in Chapter 2). Such alternatives differ mostly in usage details, not language.
The examples in this book were run on a Windows 7 and 8 ultrabook,[3] though Python’s portability makes this mostly a moot point, especially in this fundamentals-focused book. You’ll notice a few Windows-isms—including command-line prompts, a handful of screenshots, install pointers, and an appendix on the new Windows launcher in 3.3—but this reflects the fact that most Python newcomers will probably get started on this platform, and these can be safely ignored by users of other operating systems.
I also give a few launching details for other platforms like Linux, such as “#!” line use, but as we’ll see in Chapter 3 and Appendix B, the 3.3 Windows launcher makes even this a more portable technique.
Source code for the book’s examples, as well as exercise solutions, can be fetched as a zip file from the book’s website at the following address:
| http://oreil.ly/LearningPython-5E |
This site includes both all the code in this book as well as package usage instructions, so I’ll defer to it for more details. Of course, the examples work best in the context of their appearance in this book, and you’ll need some background knowledge on running Python programs in general to make use of them. We’ll study startup details in Chapter 3, so please stay tuned for information on this front.
The code in my Python books is designed to teach, and I’m glad when it assists readers in that capacity. O’Reilly itself has an official policy regarding reusing the book’s examples in general, which I’ve pasted into the rest of this section for reference:
This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Learning Python, Fifth Edition, by Mark Lutz. Copyright 2013 Mark Lutz, 978-1-4493-5573-9.”
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com.
[3] Mostly under Windows 7, but it’s irrelevant to this book. At this writing, Python installs on Windows 8 and runs in its desktop mode, which is essentially the same as Windows 7 without a Start button as I write this (you may need to create shortcuts for former Start button menu items). Support for WinRT/Metro “apps” is still pending. See Appendix A for more details. Frankly, the future of Windows 8 is unclear as I type these words, so this book will be as version-neutral as possible.