You need this book because you need to learn Python. Here are a few reasons why you might need to learn Python
- You need a programming language that is easy to read and has a vast library of modules focused on solving the problems you’re faced with.
- You saw an article about Python specifically, or dynamic languages in general, and want to learn more.
- You’re starting a project where Python will be used or is in use.
- A colleague has suggested that you look into Python.
- You’ve run across a Python code sample on the web and need to learn more.
Python reflects a number of growing trends in software development, putting it at or near the leading edge of good programming languages. It is a very simple language surrounded by a vast library of add-on modules. It is an open source project, supported by many individuals. It is an object-oriented language, binding data and processing into class definitions. It is a platform-independent, scripted language, with complete access to operating system API‘s. It supports integration of complex solutions from pre-built components. It is a dynamic language, which avoids many of the complexities and overheads of compiled languages.
This book is a close-to-complete presentation of the Python language. It is oriented toward learning, which involves accumulating many closely intertwined concepts. In our experience teaching, coaching and doing programming, there is an upper limit on the “clue absorption rate”. In order to keep within this limit, we’ve found that it helps to present a language as ever-expanding layers. We’ll lead you from a very tiny, easy-to-understand subset of statements to the entire Python language and all of the built-in data structures. We’ve also found that doing a number of exercises helps internalize each language concept.
Three Faces of a Language. There are three facets to a programming language: how you write it, what it means, and the additional practical considerations that make a program useful. While many books cover the syntax and semantics of Python, in this book we’ll also cover the pragmatic considerations. Our core objective is to build enough language skills that good object-oriented design will be an easy next step.
The syntax of a language is covered in the language reference manual available online. In the case of relatively simple languages, like Python, the syntax is simple. We’ll provide additional examples of language syntax.
The semantics of the language can be a bit more slippery than the syntax. Some languages involve obscure or unique concepts that make it difficult to see what a statement really means. In the case of languages like Python, which have extensive additional libraries, the burden is doubled. First, one has to learn the language, then one has to learn the libraries. The number of open source packages made available by the Python community can increase the effort required to understand an entire architecture. The reward, however, is high-quality software based on high-quality components, with a minimum of development and integration effort.
Many languages offer a number of tools that can accomplish the same basic task. Python is no exception. It is often difficult to know which of many alternatives performs better or is easier to adapt. We’ll try to focus on showing the most helpful approach, emphasizing techniques that apply for larger development efforts. We’ll try to avoid “quick and dirty” solutions that are only appropriate when learning the language.