Happy Black Friday! OK, I know: It’s not really a holiday. And I don’t even live in the US. But somehow, Black Friday has become a world-wide shopping and discount phenomenon. Like many other independent authors and trainers, I’m offering big discounts today — 40% off all of my books and courses. The discount is…
In just 48 hours, I’ll be starting my latest round of live, online courses. Wondering what it’s like to take an online course from me? Or perhaps you’re wondering what sorts of topics I’ll discuss in my “Python dictionaries” and “Python functions” courses? If you are a beginning or intermediate Python developer, then you’ll become…
Confused by Python dicts, or wondering how you can take advantage of them in your programs? Do you wonder how Python functions work, and how you can make them more “Pythonic,” and easier to maintain? Do you wonder why everyone raves about Git, when it seems impossibly hard to understand? Cloning, pulling, and pushing mostly…
Back in July, I gave three live, online courses: Object-oriented Python, functional Python, and Python decorators. I have long found that all three subjects are misunderstood by many Python developers, and I wanted to help people to understand how and when to use each one. I’m pleased to announce that recordings from all three courses…
Students in my Python classes occasionally get the following error message: TypeError: object() takes no parameters This error message is technically true, as I’ll explain in a moment. But it’s surprising and confusing for people who are new to Python, because it doesn’t point to the source of the actual problem. Here’s the basic idea:…
Let’s define a simple Python function: In [1]: def foo(x): …: return x * x …: In [2]: foo(5) Out[2]: 25 In [3]: foo(10) Out[3]: 100 As we can see, this function has a single parameter, “x”. In Python, parameters are local variables whose values are set by whoever is calling the function. So we…
The most common question I get from students in my Python classes is: How can we practice and improve our skills after the course is over? These students realize that no matter how good a course might be, they won’t retain very much if they don’t use and practice their Python on a regular basis.…
Python’s “subprocess” module makes it really easy to invoke an external program and grab its output. For example, you can say import subprocess print(subprocess.check_output(‘ls’)) and the output is then $ ./blog.py b’blog.py\nblog.py~\ndictslice.py\ndictslice.py~\nhexnums.txt\nnums.txt\npeanut-butter.jpg\nregexp\nshowfile.py\nsieve.py\ntest.py\ntestintern.py\n’ subprocess.check_output returns a bytestring with the filenames on my desktop. To deal with them in a more serious way, and to have the…
One of Python’s mantras is “batteries included.” which means that even with a bare-bones installation, you can do quite a bit. You can (and should) install packages from PyPI, but many day-to-day tasks can be accomplished with just the built-in data structures, functions, and methods. What I’ve discovered over the years is that some of…
Today is my birthday! To celebrate, I’m offering a one-day 47% sale on many of my products: My upcoming live classes (on functional Python, advanced Python objects, and decorators) are all 47% off Practice Makes Python (developer package), with 50 exercises to help you improve your Python, is 47% off Practice Makes Regexp (consultant package),…