Python is an amazing programming language. It can be applied to almost any programming task, allows for rapid development and debugging, and brings the support of what is arguably the most welcoming user community.
Getting started with Python is like learning any new skill: it’s important to find a resource you connect with to guide your learning. Luckily, there’s no shortage of excellent books that can help you learn both the basic concepts of programming and the specifics of programming in Python. With the abundance of resources, it can be difficult to identify which book would be best for your situation.
In this article, we highlight the best books for learning Python through a collection of book reviews. Each review gives you a taste of the book, the topics covered, and the context used to illustrate those topics. Different books will resonate with different people, depending on the style and presentation of the books, the readers’ backgrounds, as well as other factors.
If you are new to Python, any of the introductory books will give you a solid foundation in the basics.
Perhaps you want to learn Python with your kid, or maybe teach Python to a group of kids. Check out the Best Python Books for Kids for resources aimed at a younger audience.
As you progress in you Python journey, you will want to dig deeper to maximize the efficiency of your code. The best intermediate and advanced Python books provide insight to help you level up your Python skills, enabling you to become an expert Pythonista.
After reading these reviews, if you still are not sure which book to choose, publishers often provide a sample chapter or section to give you an example of what the book offers. Reading a sample of the book should give you the most representative picture of the author’s pace, style, and expectations.
Regardless of which book most stands out, consider this anecdote from one of our book reviewers, Steven C. Howell:
“A favorite professor once told me, ‘It doesn’t matter which book you read first. It’s always the second one that makes the most sense.’
I can’t say this has always been the case for me, but I’ve definitely found that a second reference can make all the difference when the first left me puzzled or frustrated.
When learning Python classes, I had difficulty relating to the examples used in the first two books I picked up. It wasn’t until the third book I referred to that the concepts started to click.
The important lesson is that if you get stuck or frustrated, and the resources you have are not helping, then don’t give up. Look at another book, search the web, ask on a forum, or just take a break.”
Note: This article contains affiliate links to retailers like Amazon, so you can support Real Python by clicking through and making a purchase on some of the links. Purchasing from one of these links adds no extra cost to you. Affiliate links never influence our editorial decisions in any way.
Best Books for Learning Python
If you are new to Python, you are likely in one of the following two situations:
- You are new to programming and want to start by learning Python.
- You have a reasonable amount of programming experience in another language and now want to learn Python.
This section focuses on the first of these two scenarios, with reviews of the books we consider to be the best Python programming books for readers who are new to both programming and Python. Accordingly, these books require no previous programming experience. They start from the absolute basics and teach both general programming concepts as well as how they apply to Python.
- Think Python: The most basic of this list, Think Python provides a comprehensive Python reference.
- Fluent Python: While Python’s simplicity lets you quickly start coding, this book teaches you how to write idiomatic Python code, while going into several deep topics of the language.
- Effective Python: 59 Ways to Write Better Python: This relatively short book is a collection of 59 articles that, similarly to Fluent Python, focus on teaching you how to write truly Pythonic code.
- Python Cookbook: As a cookbook, this will be a good reference on how to use Python to complete tasks you have done in another language.
Alternatively, you may even prefer to go directly to the official Python Tutorial, a well-written and thorough resource.
Python Crash Course
Eric Matthes (No Starch Press, 2016)
It does what it says on the tin, and it does it really well. The book starts out with a walkthrough of the basic Python elements and data structures, working through variables, strings, numbers, lists, and tuples, outlining how you work with each of them.
if statements and logical tests are covered, followed by a dive into dictionaries.
After that, the book covers user input,
while loops, functions, classes, and file handling, as well as code testing and debugging.
That’s just the first half of the book! In the second half, you work on three major projects, creating some clever, fun applications.
The first project is an Alien Invasion game, essentially Space Invaders, developed using the
pygame package. You design a ship (using classes), then program how to pilot it and make it fire bullets. Then, you design several classes of aliens, make the alien fleet move, and make it possible to shoot them down. Finally, you add a scoreboard and a list of high scores to complete the game.
After that, the next project covers data visualization with
matplotlib, random walks, rolling dice, and a little bit of statistical analysis, creating graphs and charts with the
pygal package. You learn how to download data in a variety of formats, import it into Python, and visualize the results, as well as how to interact with web APIs, retrieving and visualizing data from GitHub and HackerNews.
The third project walks you through the creation of a complete web application using Django to set up a Learning Log to track what users have been studying. It covers how to install Django, set up a project, design your models, create an admin interface, set up user accounts, manage access controls on a per-user basis, style your entire app with Bootstrap, and then finally deploy it to Heroku.
This book is well written and nicely organized. It presents a large number of useful exercises as well as three challenging and entertaining projects that make up the second half of the book. (Reviewed by David Schlesinger.)
Head-First Python, 2nd edition
Paul Barry (O’Reilly, 2016)
I really like the Head-First series of books, although they’re admittedly lighter weight in overall content than many of the other recommendations in this section. The trade-off is the that this approach makes the book more user-friendly.
If you’re the kind of person who likes to learn things one small, fairly self-contained chunk at a time, and you want to have lots of concrete examples and illustrations of the concepts involved, then the Head-First series is for you. The publisher’s website has the following to say about their approach:
“Based on the latest research in cognitive science and learning theory, Head-First Python uses a visually rich format to engage your mind, rather than a text-heavy approach that puts you to sleep. Why waste your time struggling with new concepts? This multi-sensory learning experience is designed for the way your brain really works.” (Source)
Chock full of illustrations, examples, asides, and other tidbits, Head-First Python is consistently engaging and easy to read. This book starts its tour of Python by diving into lists and explaining how to use and manipulate them. It then goes into modules, errors, and file handling. Each topic is organized around a unifying project: building a dynamic website for a school athletic coach using Python through a Common Gateway Interface (CGI).
After that, the book spends time teaching you how to use an Android application to interact with the website you created. You learn to handle user input, wrangle data, and look into what’s involved in deploying and scaling a Python application on the web.
While this book isn’t as comprehensive as some of the others, it covers a good range of Python tasks in a way that’s arguably more accessible, painless, and effective. This is especially true if you find the subject of writing programs somewhat intimidating at first.
This book is designed to guide you through any challenge. While the content is more focused, this book has plenty of material to keep you busy and learning. You will not be bored. If you find most programming books to be too dry, this could be an excellent book for you to get started in Python. (Reviewed by David Schlesinger and Steven C. Howell.)
Invent Your Own Computer Games with Python, 4th edition
Al Sweigart (No Starch, 2017)
If games are your thing, or you even have a game idea of your own, this would be the perfect book to learn Python. In this book, you learn the fundamentals of programming and Python with the application exercises focused on building classic games.
Starting with an introduction to the Python shell and the REPL loop, followed by a basic “Hello, World!” script, you dive right into making a basic number-guessing game, covering random numbers, flow control, type conversion, and Boolean data. After that, a small joke-telling script is written to illustrate the use of print statements, escape characters, and basic string operations.
The next project is a text-based cave exploration game, Dragon’s Realm, which introduces you to flowcharts and functions, guides you through how to define your own arguments and parameters, and explains Boolean operators, global and local scope, and the
After a brief detour into how to debug your Python code, you next implement the game of Hangman, using ASCII artwork, while learning about lists, the
in operator, methods,
elif statements, the
random module, and a handful of string methods.
You then extend the Hangman game with new features, like word lists and difficulty levels, while learning about dictionaries, key-value pairs, and assignment to multiple variables.
Your next project is a Tic-Tac-Toe game, which introduces some high-level artificial intelligence concepts, shows you how to short-circuit evaluation in conditionals, and explains the
None value as well as some different ways of accessing lists.
Your journey through the rest of the book proceeds in a similar vein. You’ll learn nested loops while building a Mastermind-style number guessing game, Cartesian coordinates for a Sonar Hunt game, cryptography to write a Caesar cipher, and artificial intelligence when implementing Reversi (also known as Othello), in which the computer can play against itself.
After all of this, there’s a dive into using graphics for your games with PyGame: you’ll cover how to animate the graphics, manage collision detection, as well as use sounds, images, and sprites. To bring all these concepts together, the book guides you through making a graphical obstacle-dodging game.
This book is well done, and the fact that each project is a self-contained unit makes it appealing and accessible. If you’re someone who likes to learn by doing, then you’ll enjoy this book.
The fact that this book introduces concepts only as needed can be a possible disadvantage. While it’s organized more as a guide than a reference, the broad range of contents taught in the context of familiar games makes this one of the best books for learning Python. (Reviewed by David Schlesinger.)
Think Python: How to Think Like a Computer Scientist, 2nd edition
Allen B. Downey (O’Reilly, 2015)
If learning Python by creating video games is too frivolous for you, consider Allen Downey’s book Think Python, which takes a much more serious approach.
As the title says, the goal of this book is to teach you how coders think about coding, and it does a good job of it. Compared to the other books, it’s drier and organized in a more linear way. The book focuses on everything you need to know about basic Python programming, in a very straightforward, clear, and comprehensive way.
Compared to other similar books, it doesn’t go quite as deep into some of the more advanced areas, instead covering a wider range of material, including topics the other books don’t go anywhere near. Examples of such topics include operator overloading, polymorphism, analysis of algorithms, and mutability versus immutability.
Previous versions were a little light on exercises, but the latest edition has largely corrected this shortcoming. The book contains four reasonably deep projects, presented as case studies, but overall, it has fewer directed application exercises compared to many other books.
If you like a step-by-step presentation of just the facts, and you want to get a little additional insight into how professional coders look at problems, this book is a great choice. (Reviewed by David Schlesinger and Steven C. Howell.)
Effective Computation in Physics: Field Guide to Research with Python
Anthony Scopatz, Kathryn D. Huff (O’Reilly, 2015)
This is the book I wish I had when I was first learning Python.
Despite its name, this book is an excellent choice for people who don’t have experience with physics, research, or computational problems.
It really is a field guide for using Python. On top of actually teaching you Python, it also covers the related topics, like the command-line and version control, as well as the testing and deploying of software.
In addition to being a great learning resource, this book will also serve as an excellent Python reference, as the topics are well organized with plenty of interspersed examples and exercises.
The book is divided into four aptly named sections: Getting Started, Getting it Done, Getting it Right, and Getting it Out There.
The Getting Started section contains everything you need to hit the ground running. It begins with a chapter on the fundamentals of the bash command-line. (Yes, you can even install bash for Windows.) The book then proceeds to explain the foundations of Python, hitting on all the expected topics: operators, strings, variables, containers, logic, and flow control. Additionally, there is an entire chapter dedicated to all the different types of functions, and another for classes and object-oriented programming.
Building on this foundation, the Getting it Done section moves into the more data-centric area of Python. Note that this section, which takes up approximately a third of the book, will be most applicable to scientists, engineers, and data scientists. If that is you, enjoy. If not, feel free to skip ahead, picking out any pertinent sections. But be sure to catch the last chapter of the section because it will teach you how to deploy software using pip, conda, virtual machines, and Docker containers.
For those of you who are interested in working with data, the section begins with a quick overview of the essential libraries for data analysis and visualization. You then have a separate chapter dedicated to teaching you the topics of regular expressions, NumPy, data storage (including performing out-of-core operations), specialized data structures (hash tables, data frames, D-trees, and k-d trees), and parallel computation.
The Getting it Right section teaches you how to avoid and overcome many of the common pitfalls associated with working in Python.
It begins by extending the discussion on deploying software by teaching you how to build software pipelines using
You then learn how to use Git and GitHub to track, store, and organize your code edits over time, a process known as version control.
The section concludes by teaching you how to debug and test your code, two incredibly valuable skills.
The final section, Getting it Out There, focuses on effectively communicating with the consumers of your code, yourself included. It covers the topics of documentation, markup languages (primarily LaTeX), code collaboration, and software licenses. The section, and book, concludes with a long list of scientific Python projects organized by topic.
This book stands out because, in addition to teaching all the fundamentals of Python, it also teaches you many of the technologies used by Pythonistas. This is truly one of the best books for learning Python.
It also serves as a great reference, will a full glossary, bibliography, and index. The book definitely has a scientific Python spin, but don’t worry if you do not come from a scientific background. There are no mathematical equations, and you may even impress your coworkers when they see you are on reading up on Computational Physics! (Reviewed by Steven C Howell.)
Learn Python 3 the Hard Way
Zed A. Shaw (Addison-Wesley, 2016)
Learn Python the Hard Way is a classic. I’m a big fan of the book’s approach. When you learn “the hard way,” you have to:
- Type in all the code yourself
- Do all the exercises
- Find your own solutions to problems you run into
The great thing about this book is how well the content is presented. Each chapter is clearly presented. The code examples are all concise, well constructed, and to the point. The exercises are instructive, and any problems you run into will not be at all insurmountable. Your biggest risk is typographical errors. Make it through this book, and you’ll definitely no longer be a beginner at Python.
Don’t let the title put you off. The “hard way” turns out to be the easy way if you take the long view. Nobody loves typing a lot of stuff in, but that’s what programming actually involves, so it’s good to get used to it from the start. One nice thing about this book is that it has been refined through several editions now, so any rough edges have been made nice and smooth by now.
The book is constructed as a series of over fifty exercises, each building on the previous, and each teaching you some new feature of the language. Starting from Exercise 0, getting Python set up on your computer, you begin writing simple programs. You learn about variables, data types, functions, logic, loops, lists, debugging, dictionaries, object-oriented programming, inheritance, and packaging. You even create a simple game using a game engine.
The next sections cover concepts like automated testing, lexical scanning on user input to parse sentences, and the
lpthw.web package, to put your game up on the web.
Zed is an engaging, patient writer who doesn’t gloss over the details. If you work through this book the right way—the “hard way,” by following up on the study suggestions provided throughout the text as well as the programming exercises—you’ll be well beyond the beginner programmer stage when you’ve finished. (Reviewed by David Schlesinger.)
Note: Of all the books included in this article, this is the only with somewhat mixed reviews. The Stack Overflow (SO) community has compiled a list of 22 complaints prefaced with the following statement:
“We noticed a general trend that users using [Learn Python the Hard Way] post questions that don’t make a lot of sense both on SO and in chat. This is due to the structure and techniques used in the book.” (Source)
They provide their own list of recommended tutorials, which includes the following:
- The official Python 3 tutorial
- Dive into Python 3
- The Invent with Python series, which includes Invent Your Own Computer Games with Python
- Think Python
Despite the negative criticism toward Learn Python the Hard Way, David Schlesinger and Amazon reviewers agree that the book is worthwhile, though you probably want to supplement your library with another Python book that could serve more as a reference. Also, be sure to do your due diligence before posting questions to Stack Overflow, as that community can be somewhat abrasive at times.
Real Python Course, Part 1
Real Python Team (Real Python, 2017)
This eBook is the first of three (so far) in the Real Python course series. It was written with the goal of getting you up and running, and it does a great job at achieving this goal. The book is a mix of explanatory prose, example code, and review exercises. The interspersed review exercises solidify your learning by letting you immediately apply what you’ve learned.
As with the previous books, clear instructions are provided up front for getting Python installed and running on your computer. After the setup section, rather than giving a dry overview of data types, Real Python simply starts with strings and is actually quite thorough: you learn string slicing before you hit page 30.
Then the book gives you a good sense of the flavor of Python by showing you how to play with some of the class methods that can be applied. Next, you learn to write functions and loops, use conditional logic, work with lists and dictionaries, and read and write files.
Then things get really fun! Once you’ve learned to install packages with
pip (and from source), Real Python covers interacting with and manipulating PDF files, using SQL from within Python, scraping data from web pages, using
matplotlib to do scientific computing, and finally, creating graphical user interfaces with
What I like best about Real Python is that, in addition to covering the basics in a thorough and friendly way, the book explores some more advanced uses of Python that none of the other books hit on, like web-scraping. There are also two additional volumes, which go into more advanced Python development. (Reviewed by David Schlesinger.)
Disclaimer: I first started using the Real Python books several years ago, when they were still in beta. I thought then—and still think now—that they’re one of the best resources available to learn the Python language and several ways it can be used. My gig writing articles on the Real Python web site is a much more recent development, and my review is completely independent. — David
Best Python Books for Kids
The following books are aimed at adults interested in teaching kids to code, while possibly learning it themselves along the way. Both of these books are recommended for kids as young as 9 or 10, but they are great for older kids as well.
It’s important to note that these books are not meant to be just handed to a kid, depending on their age. They would be ideal for a parent who wanted to learn Python alongside their child.
Python for Kids: A Playful Introduction to Programming
Jason R. Briggs (No Starch, 2013)
“Playful” is right! This is a fun book for all ages, despite its title. It provides a clear, easy to follow, introduction to Python programming. It’s profusely illustrated, the examples are straightforward and clearly presented, and it’s a solid guide for someone who wants to get a good grounding in the basics, plus a little more.
The book begins with an excellent, detailed guide to getting Python installed on your system, whether that’s Windows, OS X, or Ubuntu Linux. It then proceeds to introduce the Python shell and how it can be used as a simple calculator. This serves to introduce some basic concepts like variables and arithmetic operation.
Next, iterables are tackled, and the chapter works its way progressively through strings, lists, tuples, and dictionaries.
Once that’s accomplished, the Python
turtle library is used to begin working with turtle graphics, a popular framework for teaching children to code.
From there, the book progresses through conditional statements, loops, functions, and modules.
Classes and objects are covered, followed by a truly excellent section on Python’s built-in functions, and then a section on a number of useful Python libraries and modules.
Turtle graphics are revisited in greater detail, after which the book introduces
tkinter for creating user interfaces, better graphics, and even animations.
This concludes part 1 of the book, “Learning to Program,” with the remainder focused on building two fun application projects.
The first project is to build a single-player version of Pong, called Bounce!
This integrates the programming concepts of functions, classes, and control flow, together with the tasks of creating an interface using
tkinter, illustrating to the canvas, performing geometric calculations, and using event bindings to create interactivity.
In the second project, you build a side-scrolling video game, Mr. Stickman Races for the Exit. This game applies many of the same concepts and tasks as Bounce! but with more depth and increased complexity. Along the way, you also get introduced to the open source image manipulation program GIMP, used to create your game’s assets. The book gets an amazing amount of mileage out of these two games, and getting them working is both instructive and a lot of fun.
I really like this book. Whether you are young, or just young at heart, you will enjoy this book if you are looking for a fun, approachable, introduction to Python and programming. (Reviewed by David Schlesinger and Steven C. Howell.)
Teach Your Kids to Code: A Parent-Friendly Guide to Python Programming
Bryson Payne (No Starch, 2015)
This book is similar to Python for Kids but intended more for an adult working with a child (or children) to learn to code, as the title suggests. One thing that sets this book apart from most introductory books is the use of color and illustrations on almost every page. The book is well written and presents learning to code as a way to teach children problem-solving skills.
As is commonly the case, this book begins with a Python installation guide. Compared to Python for Kids, the guide in this book is more cursory but completely adequate.
The first activity is, again, turtle graphics. A number of basic variations on drawing a rotated square are presented—without a lot of underlying explanation, initially—just to introduce the general concepts, but by the end of the section, you’ll have been provided with a pretty good understanding of the basics.
Next, calculations, variables, and mathematics in Python are explained. Once strings have been covered, the book brings all of that back into turtle graphics to enhance and explore the work that was done earlier. By this point, the code explanations are extremely clear, with explicit line-by-line details. You’d have a hard time misunderstanding any of the code presented.
Lists are explored next, as is the
Loops are introduced and then used to create increasingly complex graphics with the turtle.
Conditional expressions come next, along with Boolean logic and operators.
random library is introduced with a guessing game and randomly placed spirals made with turtle graphics. You explore randomness further by implementing rolling dice and picking cards, which leads up to you creating the games Yahtzee and War.
Functions, more advanced graphics, and user interaction are investigated next.
The book then branches off to cover using PyGame to create even more advanced graphics and animations, and then user interaction to create a very simple drawing program.
At this point, you have all the tools to create some real games. Development of both a full-featured version of Pong and a bubble-popping game are presented. Both provide enough depth to pose some challenges and maintain interest.
What I like best about this book is its large number of programming challenges, as well as the excellent summaries at the end of each chapter reminding you what was covered. If you and your child are interested in programming, this book should take both of you a good distance, and you’ll have a lot of fun. As the author, Dr. Bryson Payne, said in his recent TEDx talk, “Step out of your comfort zone, and become literate in the language of technology.” (Reviewed by David Schlesinger and Steven C. Howell.)
Best Intermediate and Advanced Python Books
Knowing Python is one thing. Knowing what’s Pythonic takes practice. Sometimes Python’s low barrier to entry gives people the mistaken idea that the language is less capable than other languages, that style does not matter, or that best practices are only a matter of preference. Have you ever seen Python code that looked like C or Fortran?
Learning how to use Python effectively requires some understanding of what Python is doing under the hood. Pythonic programming takes advantage of how the Python language is implemented to maximize the efficiency of your code.
Fortunately, there are some excellent books, packed with expert guidance, aimed to help you take what you’ve learned and level up your skills. Any of the books in this section will give you a deeper understanding of Python programming concepts and teach you how to write developer-style Python code. Note that these are by no means introductory books. They do not include the basics of getting started. These books will be helpful if you are already coding in Python and want to further hone your skills on your path to becoming a serious Pythonista.
Python Tricks: A Buffet of Awesome Python Features
Dan Bader (dbader.org, 2017)
This book illustrates valuable lesser-known Python features and best practices, written to help you gain a deeper understanding of Python. Each of the 43 subsections presents a different concept, referred to as a Python Trick, with discussion and easy-to-digest code examples illustrating how you can take advantage of that concept.
The book’s content is broken into the following sections:
- Patterns for Cleaner Python
- Effective Functions
- Classes & OOP
- Common Data Structures in Python
- Looping & Iteration
- Dictionary Tricks
- Pythonic Productivity Techniques
As it says on the cover, the content is organized as “A Buffet,” with each subsection being a self-contained topic, with a brief introduction, examples, discussion, and list of Key Takeaways. As such, you should feel free to jump around to whichever sections are the most appealing.
In addition to the book, I particularly enjoyed the 12 Bonus Videos that are available when you purchase this as an eBook. They have an average length of 11 minutes, perfect for watching during lunch. Each video illustrates a different concept using clear and concise code examples that are simple to reproduce. While some of the videos covered familiar concepts, they still provided interesting insight without dragging on. (Reviewed by Steven C. Howell.)
Disclaimer: Though this book is officially distributed through Real Python, I recommend it independently of my connection with Real Python. I purchased this book when it was first released, before I had the opportunity to write for Real Python. For further evidence of the value of this book, check out the Amazon reviews: 148, averaging 4.8 out of 5 stars, at the time of this review. — Steve
Fluent Python: Clear, Concise, and Effective Programming
Luciano Ramalho (O’Reilly, 2014)
This book was written for experienced Python 2 programmers who want to become proficient in Python 3.
Consequently, this book is perfect for someone with a solid foundation in the basics of Python, 2 or 3, who wants to take their skills to the next level.
Additionally, this book also works well as a reference for an experienced programmer from another language who wants to look up “How do I do
<x> in Python?”
The book is organized by topic so that each section can be read independently. While many of the topics covered in this book are found in introductory books, Fluent Python provides much more detail, illuminating many of the more nuanced and overlooked features of the Python language.
The chapters are broken into the following six sections:
- Prologue: introduces Python’s object-oriented nature and the special methods that keep Python libraries consistent
- Data Structures: covers sequences, mappings, sets, and the difference between
- Functions as Objects: explains the consequences of functions being first-class objects in the Python language
- Object-Oriented Idioms: includes references, mutability, instances, multiple inheritance, and operator overloading
- Control Flow: extends beyond the basic conditionals and covers the concept of generators, context managers, coroutines,
yield fromsyntax, and concurrency using
- Metaprogramming: explores the lesser know aspects of classes, discussing dynamic attributes and properties, attribute descriptors, class decorators, and metaclasses
With code examples on almost every page, and numbered call-outs linking lines of code to helpful descriptions, this book is extremely approachable. Additionally, the code examples are geared toward the interactive Python console, a practical approach to exploring and learning the concepts presented.
I find myself turning to this book when I have a Python question and want an explanation that is more thorough than the one I would likely get on Stack Overflow. I also enjoy reading this book when I have a bit of down-time and just want to learn something new. On more than one occasion, I have found that a concept I recently learned from this book unexpectedly turned out to be the perfect solution to a problem I had to solve. (Reviewed by Steven C. Howell.)
Effective Python: 59 Ways to Write Better Python
Brett Slatkin (Addison-Wesley, 2015)
This book is a collection of 59 independent articles that build on a basic understanding of Python to teach Pythonic best practices, lesser known functionality, and built-in tools. The topics range in complexity, beginning with the simple concept of being aware of which Python version you’re using, and ending with the more complicated, and typically ignored, concept of identifying memory leaks.
Each article is a combination of example code, discussion, and a list of things to remember.
As each article is independent, this is a great book to jump around in, allowing you to focus on the topics that are most applicable or interesting. This also makes it perfect for reading one article at a time. With each article being around two to four pages in length, you could make time to read one article per day, finishing the book in two to three months (depending on whether you read on weekends).
The articles are grouped into the following 8 chapters:
- Pythonic Thinking: introduces the best ways to perform common tasks, while taking advantage of how Python is implemented
- Functions: clarifies nuanced differences of Python functions and outlines how to use functions to clarify intention, promote reuse, and reduce bugs
- Classes and Inheritance: outlines the best practices when working with Python classes
- Metaclasses and Attributes: illuminates the somewhat mysterious topic of metaclasses, teaching you how to use them to create intuitive functionality
- Concurrency and Parallelism: explains how to know to write multi-threaded applications in Python
- Built-in Modules: introduces a few of Python’s lesser-known built-in libraries to make your code more useful and reliable
- Collaboration: discusses proper documentation, packaging, dependency, and virtual environments
- Production: covers the topics of debugging, optimization, testing, and memory management
If you have a solid foundation in Python and want to fill in holes, deepen you understanding, and learn some of the less obvious features of Python, this would be a great book for you. (Reviewed by Steven C. Howell.)
David Beazley & Brian K. Jones (O’Reilly, 3rd edition, 2013)
What makes this book stand out is its level of detail. Code cookbooks are typically designed as short and sweet manuals to illustrate slick ways of doing everyday tasks. In this case, each recipe in Python Cookbook has an extended code solution as well as an author’s discussion of some particular elements of the solution.
Each recipe starts out with a clear problem statement, such as, “You want to write a decorator that adds an extra argument to the calling signature of the wrapped function.” It then jumps into a solution that uses modern, idiomatic Python 3 code, patterns, and data structures, often spending four to five pages discussing the solution.
Based on its more involved and sophisticated examples, and the authors’ own recommendation in the preface, this is probably the most advanced Python book on our list. Despite that, don’t be scared away if you consider yourself an intermediate Python programmer. Who’s judging, anyway? There’s an old saying that goes something like this:
“The best way to become a better basketball player is to lose to the best players you can find, rather than beating the worst.”
You may see some code blocks you don’t fully understand—come back to them in a few months. Re-read those sections after you’ve picked up a few additional concepts, and suddenly, it will click. Most of the chapters start out fairly straightforward, and then gradually become more intense.
The latter half of the book illustrates designs like decorator patterns, closures, accessor functions, and callback functions.
It’s always nice to read from a trustworthy source, and this book’s authors certainly fit that bill. David Beazley is a frequent keynote speaker at events such as PyCon and also the author of Python Essential Reference. Similarly, Brian K. Jones is a CTO, the creator of a Python magazine, and founder of the Python User Group in Princeton (PUG-IP).
This particular edition is written and tested with Python 3.3. (Reviewed by Brad Solomon.)
One of the awesome things about Python is it has a relatively low barrier to entry, compared to many other languages. Despite this, learning Python is a never-ending process. The language is relevant for such a wide variety of tasks, and evolves so much that there will always be something new to discover and learn. While you can pick up enough Python to do some fun things in a week or two, people who’ve been using Python for twenty years will tell you they’re still learning new things they can do with this flexible and evolving language.
To ultimately be successful as a Python programmer, you need to begin with a solid foundation, then gain a deeper understanding of how the language works, and how to best put it to use. To gain a solid foundation, you really can’t go wrong with any of the best books to learn Python. If you want to learn Python with a child, or maybe teach a group of kids, check out the list of best Python books for kids. After you’ve got your feet wet, check out some of the best intermediate and advanced Python books to dig in deeper to less obvious concepts that will improve the efficiency of your code.
All of these books will teach you what you need to know to legitimately call yourself a Python coder. ::...
当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
订阅 substack 体验古早写作:
点击注册~> 获得 100$ 体验券:
关于 ~ DebugUself with DAMA ;-)
公安备案号: 44049002000656 ...::