Today we’ll do some operator overloading, or change the behavior of some infix operators (+ and *) for our own handmade classes. There are legitimate reasons for doing so: if adding a behavior for + makes sense for your class, you can improve the readability of your code and make your classes easier to use. … Continue reading Operator overloading in Python; or, how to lose friends and annoy people
Writing technically proficient code on a line-by-line basis is all well and good, but paying attention only to the micro aspect of our code is a recipe for disaster. But oftentimes that’s what we do, especially as beginners. When we’re just starting out, we struggle with learning the tools, jargon and syntax so that we … Continue reading A Shaky Introduction to the SOLID Principles
Before I even tell you about today’s Python tip, I’ll warn you that there are a lot of opinions on the Internet about whether it’s even a good idea to use, so be sure to pick a side and dig in! Anyway, YMMV, and if you’re writing code that needs to be maintained by a … Continue reading Thing people on the Internet have an opinion about: Python’s loop/else
This is the inaugural post in an occasional series introducing more-than-basic functionality in Python. It’s commonly recognized that Python is an easy language to start learning, but not an easy language to fully master due to its size and scope. My intent here isn’t to give a systematic intro to post-basic Python but to share … Continue reading Python Goes Meta: Functions Returning Functions, Oh My!
Students, even those with minimal computer science training, don’t often have issues with the concept of a data type when learning Python. A string is put inside a string, and an integer holds an integer; so far, so good. But the primitive data types pose few issues for understanding because students are relying on intuitions … Continue reading A philosophical investigation of data types
Let’s get the obvious out of the way: You don’t actually want to overflow a stack. But if, like me, you get most of your knowledge these days from stackoverflow.com, you may have wondered about the provenance of that website’s name. While I can’t tell you why they called it Stack Overflow per se, I … Continue reading How to overflow a stack