If you’ve been programming in Python for any length of time, then you’ve undoubtedly heard that “everything is an object.”
But what does that mean? And who cares? And what effect does that have on you as a developer — or on Python, as a language?
Indeed, how can (and should) you take advantage of Python’s object-oriented facilities to make your code more readable, maintainable, standard, and (dare I say it) Pythonic?
If you’re relatively new to Python, and have been struggling with some of these same questions, or if you’re just wondering about the differences between instances, classes, methods, and attributes, then I have good news for you: The upcoming cohort of Weekly Python Exercise is all about object-oriented programming.
In this 15-week course, you’ll learn in the best way I know, by solving problems and discussing them with others. As you work through the exercises, you’ll get a better understanding of:
Weekly Python Exercise, of course, is a family of 15-week classes designed to help improve your Python fluency. Each course works the same:
WPE A-level courses are for beginners, while B-level courses are for more advanced Python developers. But you can take any or all of them, in any order — and there’s no overlap between the exercises in these classes and any of the previous books/courses I’ve given.
This new cohort (A3) will be starting on Tuesday, September 17th. To join, you must sign up before September 10th. But if you sign up by September 3rd, you’ll get the early-bird discount, bringing the price down to $80 — more than $20 off the full price.
I won’t be offering these exercises for at least one more year. So if you want to sharpen your OO skills before the autumn of 2020, then you should act now.
As always, you can get an even better price if you’re a student, pensioner/retiree/senior citizen, or living permanently outside of the world’s 30 richest countries. Just reply to this e-mail, and I”ll send you the appropriate coupon code.
And if several people (at least five) from your company want to join together? Let me know, and I’ll give you an additional discount, too.
There’s lots more to say about Weekly Python Exercise, now in its third year of helping Python developers from around the world to write better code — doing more in less time, and getting better jobs than before. You can read more, and try to some sample exercises, at https://WeeklyPythonExercise.com/ .
But if you’ve always wanted to improve your fluency with Python objects, then you can just sign up at https://WeeklyPythonExercise.com/ .
Don’t wait, though! The early-bird discount ends on September 3rd.
About a month ago, I started my “Python standard library video explainer series” on YouTube. My goal is to walk through the Python standard library, one little bit at a time — explaining it to Python developers, and also discovering (for myself) the many gems that exist in there, but which I’ve never had a chance to discover or work with.
The series now has more than 25 videos, with more than 2.5 hours of content. I’m currently still on the “builtins” area of the standard library, but will soon be making my way into non-builtin modules. I have already learned a lot in preparing this series, and expect to learn much more as I march through the standard library, one little bit at a time.
As is always the case when I teach, I use the Jupyter notebook and live-code as I explain things. One viewer/subscriber suggested that I should share these Jupyter notebooks with the public.
And so, as of earlier today, you can get copies of the Jupyter notebooks I used in making my videos from GitHub: https://github.com/reuven/video-explainer-notebooks . I hope that the combination of Jupyter + videos will help people to understand Python better.
Subscribe to my YouTube channel, and you’ll get updates whenever I add to my explainer series!
I’ve attended two Python conferences so far this year: PyCon (in May, in Cleveland, Ohio) and EuroPython (in July, in Basel, Switzerland). Both were fantastic; I was happy to be a sponsor at PyCon in the US, and to give my “practical decorators” talk at both conferences.
While in Basel, I heard about PyCon Africa, a conference for people from all over Africa to come and share their Python knowledge with one another. And while I couldn’t make it (since I’m giving my “Python for non-programmers” course to a company in the US), I was delighted to become a bronze sponsor of the conference, under the Weekly Python Exercise name.
I hope that this year’s PyCon Africa, which starts today, is so over-the-top successful that it’ll happen again next year — and that I’ll be able to join it in person.
Meanwhile, don’t forget that if you want to improve your Python fluency, then Weekly Python Exercise offers a family of 15-week courses, at both beginner and advanced levels, to help you out. And if you live outside of the world’s 30 richest countries, then you’re entitled to a very steep discount on the enrollment fee. A new beginner-level cohort starts in September; find out more at https://WeeklyPythonExercise.com/ !
Today (Sunday, July 14th) is my birthday. And as happens every year, I’m celebrating with huge discounts on all of my online courses and books. I’m now 49, so you can get 49% off of anything in my online store. But as with birthdays, this massive sale won’t last long — it ends Monday evening.
Just use the coupon code BD2019 at my online store (https://store.lerner.co.il/), for 49% off of the following:
This is the biggest discount I’ve ever given on these courses… so enjoy the discount, celebrate my birthday with me, and improve your understanding of Python, data science, and Git while you can.
Questions? Just e-mail me at email@example.com.
If you’ve been using Python for at least six months, but still find yourself searching on Stack Overflow and Google for answers to your problems — you’re not alone.
The good news is that the solution to your problem, to greater Python fluency, is easy: Practice, practice, and more practice.
My new advanced-level cohort of Weekly Python Exercise starts on Tuesday (July 2nd). Today is the deadline to sign up! Just go to https://WeeklyPythonExercise.com/ to learn more and start improving your Python skills.
A month or two ago, I saw an online quiz that caught my eye: How much of the Python standard library do you know?
Now, the “standard library” is the collection of modules and packages that come with Python. It constitutes the “batteries” that “batteries included” refers to in the Python world. And the standard library is big, with about 300 modules, each of which contains functions, classes, and values. Knowing the standard library, and how to use it, is essential to productive use of Python.
And yet, a large number of the people responding indicated that they knew very little of the standard library. Which makes sense, given that each of us tends to focus on what’s important to our jobs.
Indeed, I’ve been using Python for a long time. And I had to admit that there are large parts of the standard library with which I’m totally unfamiliar. I’m sure that there are gems (no Ruby pun intended) in there that I could make use of in my work, if I only knew about them.
I’ve thus decided to try an experiment, namely to walk through the entire standard library (or as much as I can physically, humanly do) in an open-ended YouTube video series. I’ve already uploaded a number of the videos, and I will be uploading a few new ones every week. I’m starting with the builtin types, walking through each of their methods — but I’ll then proceed to the other and lesser-known modules.
This is all new content, certainly overlapping my previous writing and courses to some degree, but made new for this series. It’s less formal than my courses, without any exercises or background theory connecting it all together. And yet, I’ve already learned about a number of methods and techniques — and I assume that the same will be true for you.
This video explainer is on YouTube, so you can watch it easily by subscribing to my channel there, at https://www.youtube.com/reuvenlerner. This is a long-term project, but one that I hope will be helpful and of use to you and to the entire Python community! Subscribe to my channel, and you’ll get updated whenever I add new videos.
Let’s face it: Stack Overflow has made developers’ lives easier. Almost every time I have a question, I find that someone on Stack Overflow has asked it, and that people have answered it, often in great detail.
I’m thus not against Stack Overflow, not by a long shot. But I have found that many Python developers visit there 10 or even 20 times a day, to find answers (and even code) that they can use to solve their problems.
Can you work this way? Yes, and many people do — but it’s not the ideal, which would be to have greater Python fluency. If you could know how to solve the problem without looking it up, you would be able to accomplish more in less time.
Moreover, achieving Python fluency means that when you do need to search, you’ll do it better, more quickly, and more accurately than before. You’ll be able to design larger and more complex systems, using your greater understanding of Python’s functionality and data structures to construct more sophisticated systems.
How can you achieve such fluency? Practice, practice, and more practice.
Weekly Python Exercise is a family of 15-week courses, each of which gives you that practice, along with community discussion and live office hours. As you work your way through WPE’s exercises, you’ll get a better and deeper understanding of how to write Pythonic code, how to use the standard library, and what packages on PyPI are worthwhile.
Here’s what one student has to say:
From my perspective, WPE has given me a broad sense of what the Python language is all about. WPE has not just taught me syntax but has given context with respect to what types of tasks the language is meant to solve… Reuven’s explanations per task really do bring each task full circle for understanding and approach.
A new advanced-level cohort, aimed at people with at least six months of Python experience,starts on July 2nd. You can sign up at any time until then — but avoid the last-minute penalty by joining before Friday, June 28th. During this cohort, we’ll explore such topics as iterators, generators, decorators, functional programming, and threads. Every question comes with a test written in “pytest”. And you’ll be able to exchange code, ideas, and suggestions with others in your cohort via our private, exclusive forum.
If you want to solve bigger and better problems with Python, if you want to take your Python to the next level, and if you want to push yourself to learn new topics, then you should join WPE.
Learn more about Weekly Python Exercise, and how it’ll help you to become a better Python programmer — doing more in less time, and doing it better. You can learn more at https://WeeklyPythonExercise.com.
Just a reminder: Registration for the advanced (B2) cohort of Weekly Python Exercise, which will begin on July 2nd, will remain open for the next two weeks. BUT early-bird pricing ($80 for 15 weeks of Python exercises, solutions, and community) ends today — Tuesday, June 18th.
If you want to sharpen your Python skills, then there’s no better way to do that than Weekly Python Exercise.
And hey, if you’re going to sharpen your skills, why not do it at a discount? As of tomorrow, you’ll have to pay more for the same course.
Learn more at https://WeeklyPythonExercise.com/ . 100% money-back guarantee if you aren’t satisfied — but I’m sure you’ll learn so much, and be able to solve so many new problems, that you won’t want to do that.
Here’s a quick question I often ask students in my Python classes:
>>> x = 100 >>> y = x >>> x = 200
After executing the above code, what is the value of y?
Many of my students, especially those with a background in C, are surprised. Didn’t we say that “y = x”? Thus, shouldn’t a change in x be reflected by a similar change in y?
Obviously not. But why is this the case?
Assignment in Python means one thing, and one thing only: The variable named on the left should now refer to the value on the right.
In other words, when I said:
y = x
Python doesn’t read this as, “y should now refer to the variable x.” Rather, it read it as, “y should now refer to whatever value x refers to.”
Because x refers to the integer 100, y now refers to the integer 100. After these two assignments (“x = 100” and “y = x”), there are now two references to the integer 100 that didn’t previously exist.
When we say that “x = 200”, we’re removing one of those references, such that x no longer refers to 100. Instead, x will now refer to the integer 200.
But y’s reference remains in place to where it was originally pointing, to 100. And indeed, the only way to change what y is referring to is via … assignment.
Think of this as assignment inertia: Without a new and explicit assignment, a variable will continue to refer to whatever it referred to previously.
Thus, while Python does have references (i.e., variables pointing to objects), it doesn’t have pointers (i.e., variables pointing to other variables). That’s a big difference, and one that makes the language easier to understand. But references can still be a bit tricky and confusing, especially for newcomers to the language.
Remember also that in an assignment, the right side is evaluated before the left side. By the time the left-hand-side is being assigned, any variables on the right-hand-side are long gone, replaced by the final value of the expression. For example:
>>> a = 10 >>> b = 20 >>> c = 30 >>> d = a + b * c
When we assign a value to the variable “d” above, it’s only after Python has evaluated “a + b * c”. The variables are replaced by the values to which they refer, the operations are evaluated, and the final result (610) is then assigned to “d”. “d” has no idea that it was ever getting a value from “a”, “b”, or “c”.
This is just a quick reminder that if you want to join the advanced cohort of Weekly Python Exercise starting July 2nd, you should do it by tomorrow (Tuesday, June 18th).
Don’t miss this opportunity to improve your Python coding skills! We’ll be talking about iterators, generators, decorators, threads, and functional programming, and helping you to improve your skills.
Questions? Just e-mail me at firstname.lastname@example.org. But hurry, before the price goes up!