Learning Python, 5th Edition

by: Mark Lutz (0)

Get a comprehensive, in-depth introduction to the core Python language with this hands-on book. Based on author Mark Lutz’s popular training course, this updated fifth edition will help you quickly write efficient, high-quality code with Python. It’s an ideal way to begin, whether you’re new to programming or a professional developer versed in other languages.

Complete with quizzes, exercises, and helpful illustrations, this easy-to-follow, self-paced tutorial gets you started with both Python 2.7 and 3.3— the latest releases in the 3.X and 2.X lines—plus all other releases in common use today. You’ll also learn some advanced language features that recently have become more common in Python code.

  • Explore Python’s major built-in object types such as numbers, lists, and dictionaries
  • Create and process objects with Python statements, and learn Python’s general syntax model
  • Use functions to avoid code redundancy and package code for reuse
  • Organize statements, functions, and other tools into larger components with modules
  • Dive into classes: Python’s object-oriented programming tool for structuring code
  • Write large programs with Python’s exception-handling model and development tools
  • Learn advanced Python tools, including decorators, descriptors, metaclasses, and Unicode processing

The Quotes

Every object in Python is classified as either immutable (unchangeable) or not. In terms of the core types, numbers, strings, and tuples are immutable; lists, dictionaries, and sets are not

Their general form, X[I:J], means “give me everything in X from offset I up to but not including offset J.”

In simple terms, every file of Python source code whose name ends in a .py extension is a module.

The Reviews

OK. I'm a true beginner; seriously. I'm 35 yo English teacher who can easily create a WordPress site, or a Moodle course. Other than that, I know nothing of programming. HTML and CSS is easy. But all I know is copy-pasting code from CSS generators. Sure something has stick about CSS and HTML, but nothing about programming. I was terrified to even try.Until I met Python.It was love at first sight the moment I saw its syntax. It was like reading English. I felt like New in the Matrix. So I started watching tutorials on YouTube, taking courses on Udemy, and Lynda.com, but none of them provided insightful information about the ins and outs of Python; you know, like 'the devil's in the details' kind of stuff. (Sure there are some programmers who create video tutorials on YouTube but they cover only small parts of Python programming in depth and many of them left me wanting more.That's until I decided to google 'Best Python books'.I found many videos that were talking about Python Crash Course, and Python the Hard Way being better than this book, but just the fact that this is a 1600 page book left me curious.I gave it a try, and oh boy was I right.This book doesn't let you go to the next page without explaining in details what a particular concept means. And if it doesn't clarify it right on the spot, it lets you know that it will be covered on another chapter (sometimes I skipped the chapter to see if it was right -it was).I'm only on page 98 and can tell you that I have learned more by reading this book than what I've learned by watching video tutorials.Don't get me wrong. Video tutorials are fun, and many people learn from them. For instance, I've learned how to create an authentication webapp using Django. No book required.If you are a true beginner, buy this book. Don't be afraid about being 'old' and not having studied Computer Science. This book teaches you a lot of concept in a fun, user-friendly way.I'm planning on buying the other books that follow this one. (I wish the author be writing a 6th edition of this book, since we're moving to Python 3.7 now. Then, I'll buy two Django books. And then I'll start digging into tutorials to create my portfolio; the Django way.

This is a great, thorough, quality book on Python, targeted at individuals who have some experience writing programs, but who want to learn Python to write production-grade Python programs.All the people griping about how long this book is are obviously not the target audience of this book. Yes the book is long, but to effectively use a programming language, there is a lot to learn. And this book does a great job of metering out that information. All the people griping about how there's too many "forward references" to other topics, are obviously not the target audience of this book. Yes there are forward references, because there MUST be. You can't learn every topic about a language in a linear way-- it's simply not possible. If you are the target audience of this book, then you already understand that.If you've never programmed before, this is the WRONG book. If you want a quick get-acquainted book about Python, this is the WRONG book. If you want a reference manual for Python, this the WRONG book. This book does NOT claim to be any of those things. This book is a tutorial for people who have written programs before, who want to become an expert in Python. If that's you, then you understand that the book is necessarily long.The Python language is a somewhat "larger" language than "C" or old-school Java. So there is a lot to cover: "lists" are BUILT IN to the language, "sequences" are BUILT IN to the language, "dictionaries" are BUILT IN to the language, "tuples" are BUILT IN to the language, "sets" are BUILT IN to the language. This is in contrast to the Java language or "C" language. This book explains all of those BUILT INS and "why" they are built in. If you aren't interested in any of that, then this is the WRONG book for you.This book also goes into detail about why the language is designed the way it is. And it does this not only in regard to the high-level design of the language, but it does this for every nuance and detail of the language. This is great information if your goal is to follow best practices when actually using the language for real world problems. If you just want to write little toy programs and you don't care about best practices, then this is the WRONG book for you.The entirety of the Python ecosystem is MASSIVE, and this book goes into detail about a lot of that ecosystem. (Although even a book of this size does not cover ALL of that ecosystem). This includes things like: embedding Python in a larger "C" application, calling "C" functions from Python, properties, metaclasses, decorators, Unicode, exceptions, object-oriented classes, etc., etc., etc.You think it's possible to learn all that detail, learn all the best practices of managing all those language features, and do it in a 100 page book? Well, if you do, then you are not the target audience of this book. People who want to learn to use Python to do production-grade programming realize that understanding all this detail takes a lot of pages, it takes patience, and it takes forward references.

I know a 1600 page book seems almost crazy but, before you start looking elsewhere (as I did) for something shorter, let me try to explain why this 1600 page book may actually end up saving you a lot of time and making you a better Python programmer in the end.First of all, I've read many of the other well reviewed, up-to-date, Python books (yes, all of them were shorter), and being new to Python, I ended up spending most of my time searching online trying to fill in the gaps that the other authors failed to fill in. With this book you don't need to reference anything else because the author does a great job of answering every question. You can tell he's dedicated his life to teaching Python and knows what problems his readers will run into.While this books is long, it doesn't feel long. It's not just page after page of code samples. Each concept comes with a few code samples and is followed up by very well-written, clear explanations so it's actually a fairly quick read (for a 1600 page book). Does he repeat himself as other reviewers have noted? Yes, but it feels like when he does it's purposeful.Even though you often hear that Python is easy to learn, it's an incredibly deep language that requires time and effort. I believe that by having read this book that I'm starting out far ahead of other new Python programmers, I appreciate the language even more and I'm very comfortable even with Python's advanced topics.

OK. I'm a true beginner; seriously. I'm 35 yo English teacher who can easily create a WordPress site, or a Moodle course. Other than that, I know nothing of programming. HTML and CSS is easy. But all I know is copy-pasting code from CSS generators. Sure something has stick about CSS and HTML, but nothing about programming. I was terrified to even try.Until I met Python.It was love at first sight the moment I saw its syntax. It was like reading English. I felt like New in the Matrix. So I started watching tutorials on YouTube, taking courses on Udemy, and Lynda.com, but none of them provided insightful information about the ins and outs of Python; you know, like 'the devil's in the details' kind of stuff. (Sure there are some programmers who create video tutorials on YouTube but they cover only small parts of Python programming in depth and many of them left me wanting more.That's until I decided to google 'Best Python books'.I found many videos that were talking about Python Crash Course, and Python the Hard Way being better than this book, but just the fact that this is a 1600 page book left me curious.I gave it a try, and oh boy was I right.This book doesn't let you go to the next page without explaining in details what a particular concept means. And if it doesn't clarify it right on the spot, it lets you know that it will be covered on another chapter (sometimes I skipped the chapter to see if it was right -it was).I'm only on page 98 and can tell you that I have learned more by reading this book than what I've learned by watching video tutorials.Don't get me wrong. Video tutorials are fun, and many people learn from them. For instance, I've learned how to create an authentication webapp using Django. No book required.If you are a true beginner, buy this book. Don't be afraid about being 'old' and not having studied Computer Science. This book teaches you a lot of concept in a fun, user-friendly way.I'm planning on buying the other books that follow this one. (I wish the author be writing a 6th edition of this book, since we're moving to Python 3.7 now. Then, I'll buy two Django books. And then I'll start digging into tutorials to create my portfolio; the Django way.

This book has a very low information density. It could easily have been 1/2 or even 1/3 the length and covered exactly the level of detail. There are too many toy examples that are not really informative. It isn't clear if the intended audience has any programming experience or not. Some examples appear to be geared towards those who have never written any code at all (and are told how an interpreter words) and others to those who have extensive experience. At the same time, the impression is given that every feature in Python is novel, fresh and unique, when all of it has been seen before in other languages. Then, adding to the verbosity, is the continual comparisons between Python versions. Far better to have split this book into one for novices and one for experts, and drop the coverage of Python 2 entirely. As it is, this book is overly long for what it contains. K&R wrote more-or-less the same book for C in under 300 pages, rather than 1500. Thus, three stars: the book does what it claims, but it could have been written much better.

I don't write too many reviews but I have to review this book. I'm just trying to learn the language to do some web, security, and rasberry pi development on my own. I tried to learn python over a year ago, got frustrated and quit. I tried to pick up the language again about 2 weeks ago. I have read and tried to work through Learning Python the Hard Way (LPHW). LPHW is a good resource and it did give me a general understand of the language. It teaches python version 2x. I have also read Dive into Python 3 (DP3). DP3 is also a good resource and it teaches python version 3x. I have also read and referenced [...] For the most part, I am able to write simple code. But I got frustrated when I tried to review and understand complex code structures. I had a hard time understanding the nuances of the language. I spent hours searching online and watching tutorial videos. But I was constantly frustrated because there were all these exceptions that didn't make sense to me. I kept on asking why this works and why that does not work.The best thing about this book is that it explain the nuances of the language by giving multiple examples. So it does explains it in a complete manner. A lot of other resources will touch upon a topic and then glance over it. I often wondered.. what about this... so a lot of other resources expect you to test the other cases out which in most circumstance will be okay, but in others, you are still left wondering "why?". This book does not do that. In fact, I almost didn't need to try the examples on the interactive python command line because it was so thorough.This book is not for the beginner. You will get lost among the trees in the forest because there is so much information in this book. If you are impatient or need to start coding right away, you really won't be able to do this with Learning Python. LPHW and DP3 are much better at getting you up and running. But to write error free code, you have to understand the nuances of the language which Learning Python teaches you. Learning Python the Hard Way (free on the internet) and Dive into Python 3 (also free) are great resources to get introduced to the language. I would recommend both before you delve into this book. But once you get an understand of the basics of python, this book will fill in the missing details.As a disclaimer, I have only been reading this book for a day. I have already read 300 pages. A lot of it was review. But I learned a lot of new stuff as well that filled in the gaps. I have not read the section on regex or the more advanced sections yet so this review is not complete. But so far, I am impressed on the thoroughness of the subject matter.The main grip I have is that I bought the kindle version. If I read it in a linear fashion the material seem to flow nicely. But when I come to certain sections, I need to jump around. You find this a lot with any technical book. The kindle version makes this difficult because I cannot "easily" keep track of what I was reading so I get side tracked a lot. I also cannot effectively add notes (yes, I know I can add notes). I ended up using 4 devices to read this book just to keep track of where I was. I may get the hardcopy so that I have an easy quick reference book to look at later at my desk. With a hard copy, I use bookmarkers that I can quickly page to. I know about the kindle bookmarks but they are cumbersome to use. Fortunately, its hard to beat the fact that I can carry this book on my phone if I wanted to. So I would rate the kindle version 3 stars.Overall, I would buy this again on kindle.

bought it for school work

I originally bought these to go with an Aerogarden. The aerogarden stopped working 24 hours after I bought it so I returned it. I had these that I had opened and used so just kept them. I later realized they fit perfectly in the gallon Arizona tea jugs. So, I spray painted the jugs black, added the plant food to those jugs, dripped these in the top and am now using the for the Kratky hydroponic method. Way cheaper than the aerogarden system so I guess overall it was a win.

Bought a couple different brands. This did the best for all seeds sprouting.

Very good kit to get started and grow your veggies, herbs or plants.

My daughter gifted me a 6 pod unit for Christmas. I started it with herbs and got a great crop. I love that it is hydroponic and they provide you with a generous amount of fertilizer. The light heighth is adjustable as the plants mature and grow. The light is on a timer, based on the type of plants your are growing. It also has 2 LED timers:one for thedays since started (planted) and one for the days til you need to add more fertilizer (every 14 days). After a few months, my herbs had overgrown the unit and I couldnt keep up with snipping. I froze some and oven dried some the rest, and started a new crop of tomatos, placing seeds in new blank spikes. After 20 days, they are sturdy, not a bit leggy, and have grown twice as fast as any other method I have tried. They are just about ready to transplant to the garden. My next grow cycle will be various lettuces. I cant wait to have fresh salad greens this summer! An added bonus is that I placed some African Violets near the light unit and they have started reblooming after a year of just leaves. They're very happy too with the light too!

I like to use the pods to start my seedlings. It’s less messy than regular dirt and everything grows evenly

Plan on using it late fall into winter
..if it is like all of all other products should be fine, will update later

I stated lettuce and it was awesome!

Grows seeds beautiful.....sẽe photo after 29 days planted.

Quite detailed and in depth coverage of Python.I don't think you need anything else to learn python,especially if it's not your first programming language learnt.

This huge book has a comparably-sized index of 33 pages. Index thoroughness is one of the first things I look for in a reference book. If you are a moderately-advanced to advanced Python programmer, this can be your go-to book for solving some esoteric programming problems. You can read it as a very dense novel, or as I do, dip into it when necessary. I repeatedly return to this book when stumped with a Python question, the latest being exactly how the 'iter' keyword works with a list (answer on page 437). The scope and detail in this book are unbelievable. Just don't drop it on your foot.

Very thoroughly covers the differences between Python 2.X and Python 3.X which is very important because of the numerous differences between the two versions, both large and small. I love that there is an answer key to the end-of-section programming exercises. Some books give you exercises with no solutions, and it's so much more useful to have them in there if you're self-learning, so you may compare your own solution against the author's. It's 1590 pages of very clearly explained basic and not so basic instruction to the Python language. I'm very happy I bought this Python book to use to begin my Pythonic journey!

The book was as described. It was in great condition.

Every herbalist needs this book in their collection. Great designs, images, details.

This book does a really good job explaining Native American herbal medicine and the connection they see between human, spirit and nature. It is fundamental to understand this connection in order to truly see any benefits from this holistic medicine approach. I liked the way that the book explained common practices (like smudging) and medicinal herbs, plants, roots, etc. The author writes very clearly and succinctly. This keeps the reader's focus on the subject matter. I did take one star off because it would be nice to have pictures of these plants. For example, a photo of what echinacea looks like would help. I did however really appreciate the final section of the book. Here the author lists common ailments or the purpose you might want an herb for (like an astringent or something for indigestion). Then under each there is a list of plants and herbs that treat that condition. I found this a great resource.

This book contains a lot of little snippets of information from various tribes in the first few chapters. The actual herbs themselves aren’t until the last section of the book and they’re basically just listed like “antibacterial: thyme, barberry, goldenseal, echinacea, etc.” I wanted to know more about the herbs themselves than the teachings of how native Americans view medicine. My fiancĂ© is ojibwe and we live 15 mins from his reservation so that is why the teachings are less important to us than the info about the plants. It would be a great book for someone who wants to learn more about native traditions rather than the herbs and plants themselves.

Thought it would have color inside as the cover is so beautiful. Nope black and white. Makes pics hard to see.

Informative piece of literature that is meant to provide one with information about herbs that grow here in North America and that can be used in home remedies and more.Explains the herb/root. Where it grows, what they are used for.

A modern guide to Native American apothecary reads like a manua. A very informative manualThe amount of information author put into this book us exponential.And the “index” that is used to categorize all of the plants/herbs usd is phenomenal.For amount of content and how useful it is, bookgets 5 stars

The book was very helpful of how to distinguish the medicinal properties that plants and herbs have to heal the body

Some nice information and well written but no pictures to help identify the herbs you're learning about, which unfortunately is the reason I needed a book to carry with me.

The book is quite good. I've been writing python (extensively) for about 6 years at this point and found this to be a great reference - it has helped me fill in some parts of my knowledge which were lacking. Further the book does not shy away from topics like metaclasses and so on. Would recommend for just about anybody. Tons of examples and elaboration

Learning Python, 5th Edition
⭐ 4.5 💛 1758
kindle: $16.57
paperback: $30.58
Buy the Book