If I mention “decorators,” even if you’ve been programming with Python for a while, what comes to mind? To many, decorators are mysterious and powerful — and beyond the reach of mere mortals. Their @ signs pop up in all sorts of places, from “pytest” to Flask to properties… but ...

Read More

Are you confused about object-oriented Python? You’re not alone. In teaching Python to companies around the world for more than 20 years, I’ve found that almost everyone is confused by Python objects: Newcomers to object-oriented programming are just plain ol’ confused — by the terminology, the syntax, and why we ...

Read More

I haven’t been posting much to this blog of late, in part because I’ve been posting Python-related videos on YouTube. Just in the last month or two, I’ve posted: Scraping HTML with Pandas: https://www.youtube.com/watch?v=jR5ltEVe-qcThree ways to read CSV data into Python: https://www.youtube.com/watch?v=NmmrQb7xRJURemoving pairs from a dict, based on the value: ...

Read More

Python makes it easy to write functions. For example, I can write: def hello(name): return f'Hello, {name}!' I can then run the function with: hello('world') which will then, not surprisingly, return the string 'Hello, world' Here’s a question that doesn’t come up much: How does Python assign the string argument ...

Read More