A few weeks ago, I asked subscribers to my free, weekly “Better developers” list to send me their Python problems. I got about 20 responses from around the world, some more complex than others. I promised to answer some of them in video.
Why? Because becoming an expert Python developer means understanding, in a deep way, how Python works. The stronger your mental model of Python’s innards, the better you can use the language to solve problems. And watching someone solve problems, or work their way through problems in real life, helps to develop and improve those mental models.
A large proportion of my teaching takes place via exercises. (And in the case of Weekly Python Exercise, it’s the overwhelming majority of the teaching, as the name implies.) But as important as it is for my students to work through the exercises, it’s also important that I walk them through the process I use when solving the exercise. Learning the correct process is more important than getting the answer right to a specific problem, because once you start thinking in the right way, with an improved mental model, you’ll be able to solve new and different problems.
I’m trying something similar here: People ask questions, and I try to answer them. Sometimes, I’ll hit a brick wall, or an unexpected detour, or I’ll just be surprised. Guess what? This happens to all of us, and it’s part of the process of solving problems. But it’s also part of the fun and excitement of development.
With that in mind, I present the first two problems/questions that my readers submitted:
- How can we ask Python to infer an encoding from bytes?
- Is it a good idea to stick “global” data in builtins?
If you like these questions and walkthroughs, then you’ll love Weekly Python Exercise, starting on January 2nd, a year-long course for intermediate Python developers.
And if you have Python questions you’d like me to answer, join my list and ask away! If I choose your question, I’ll give you a coupon for 30% off any of my books or courses.